Until yesterday, Android developers had to build their applications to run inside Dalvik, the Java virtual machine upon which Google’s mobile OS is built. While it is beneficial in embedded systems with limited processor power and RAM, it is limiting for developers who, for example, want to create CPU-intensive, but not RAM-intensive, applications such as more in-depth computations, simulations, or signal processing.
Now that has become possible with the Android Native Developers Kit, a companion to the SDK which gives developers a way to use the ARMv5TE machine instruction set, such as libc, the standard C library, libm, the standard math library, libz, the common ZLib compression library, the Java Native Interface (JNI), and liblog, which can send logCat messages to the kernel.
“Keep in mind that using the NDK will not be relevant for all Android applications,” David Turner said in the Android Developer’s Blog yesterday. “As a developer, you will need to balance its benefits against its drawbacks, which are numerous! Your application will be more complicated, have reduced compatibility, have no access to framework APIs, and be harder to debug. That said, some applications that have self-contained, CPU-intensive operations that don’t allocate much memory may still benefit from increased performance and the ability to reuse existing code…The NDK, however, can be an effective way to reuse a large corpus of existing C/C++ code.”