The Android Native Development Kit (NDK) is a companion tool to the Android SDK. If you use the NDK to create native code, your applications are still packaged into an .apk file and run inside a VM on the device. The fundamental Android application model does not change.
In order to use the NDK, you must first install and set up the SDK. The system requirements for installing and using the NDK are as follows:
Windows XP (32-bit) or Vista (32- or 64-bit) with Cygwin 1.7 or later
Mac OS X 10.4.8 or later
Linux (32- or 64-bit)
Necessary development tools that are not provided in the NDK are as follows:
GNU Make 3.81 or later
A recent version of Awk (either GNU Awk or Nawk)
First, download and install the NDK (http://developer.android.com/sdk/ndk/index.html). Installation is simple: unzip the NDK into any directory. Here, we will refer to that directory as ndk.
Once the NDK is downloaded and installed, you will find quite a bit of documentation (located in the ndk/docs directory). We highly recommend that you read the documentation, starting with OVERVIEW.html. Also included in the NDK are samples (located in ndk/samples). The samples cover quite a bit more than this chapter will, so after you have used the NDK a bit, we recommend that you go through the samples.
In order to develop native code with the NDK, you will need to do the following:
Create a jni directory within your project.
Place your native source in the jni directory. ...