Getting Started With the NDK
The Android Native Development Kit (NDK) is a companion to the SDK and is what you use when you want part or all of your Android application to use native code. While bytecode needs to be interpreted by a virtual machine, native code can be directly executed by the device’s processor without any intermediate step, making execution faster, and sometimes much faster. The Dalvik Just-In-Time (JIT) compiler is compiling the bytecode into native code, making your applications faster by having to interpret the code less often (and ideally, only once) since it will use the native code it generated whenever it is available. When you use the NDK, the compilation into native code occurs on your development environment and not on the Android device. You may be wondering why you would need to worry about the NDK since the Dalvik JIT compiler can generate native code dynamically and therefore you could write your application in Java using the SDK. This chapter covers the reasons why you may need to use the NDK and the various ways to use it.
KeywordsVirtual Machine Assembly Code Native Code Head File Java Implementation
Unable to display preview. Download preview PDF.