I was wondering if I need to build the Android source for an application that I am developing. I need to develop an application to control a device using the I2C driver in the Kernel. Can I do this simply using the SDK and NDK? Should I instead use the SDK and NDK from my Android build?
I noticed The SDK does not have a tools directory, and when I try to run ndk/ndk-build I get the following errors.
/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++: Command not found.
Naturally there are two specific Android sites: source.android.com and developer.android.com and I understand the guides provided in these. There doesn’t appear to be anything that advises what to do with your build or why you would build the source rather than using the downloaded SDK.
One would rebuild android (variously meaning the kernel, userland, runtime system, system apps, and toolchains) if desired to add support for something not supported in the existing build, and not easily supported by modifications to the pre-built files short of rebuilding them.
i2c support/configuration is likely to be a feature of the kernel and some aspects of runtime configuration such as permissions, module loading, etc. You may well be able to achieve this on a rooted device without re-building the android runtime/userland by simply modifying some system files, though you may end up having to compile a new kernel or at least a kernel module.
It is unlikely that adding i2c support would require changing the sdk or ndk, unless you want to try to make a formal API for your task as an integrated part of android itself. Most likely whatever capabilities you end up adding to the android installation can be referenced from an app using reflection or app-supplied stub components and constants, rather than needing to change the build system’s idea of what is supported.