Android NDK

The Android NDK is a companion tool to the Android SDK that lets Android application developers build performance-critical portions of their apps in native code. The Android NDK is a toolset that lets you embed components that make use of native code in your Android applications.

Android virtual machine(VM) who can allow your application to source code to call a native code through the JNI(java native interface). This means that our application source code will call shell. And one more thing our application source code declare one more method with the “native” keyword to indicate that they are implemented through native code.

The NDK provides:

  • A set of tools and build files used to generate native code libraries from C and C++ sources
  • A way to embed the corresponding native libraries into an application package file (.apk) that can be deployed on Android devices
  • A set of native system headers and libraries that will be supported in all future versions of the Android platform, starting from Android 1.5
  • Documentation, samples, and tutorials

The latest release of the NDK supports these ARM instruction sets

  • ARMv5TE
  • ARMv7-A

Contents of the NDK

Development tools

The NDK includes a set of cross-toolchains (compilers, linkers, etc..) that can generate native ARM binaries on Linux, OS X, and Windows (with Cygwin) platforms. It provides a set of system headers for stable native APIs that are guaranteed to be supported in all later releases of the platform:

  • libc (C library) headers
  • libm (math library) headers
  • JNI interface headers
  • libz (Zlib compression) headers
  • liblog (Android logging) header
  • OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers
  • libjnigraphics (Pixel buffer access) header (for Android 2.2 and above)

Using Android NDK to Call Native Code From Android Application