Android NDK


Download the Android NDK

The Android NDK is a companion tool to the Android SDK that lets you build performance-critical portions of your apps in native code. It provides headers and libraries that allow you to build activities, handle user input, use hardware sensors, access application resources, and more, when programming in C or C++. If you write native code, your applications are still packaged into an .apk file and they still run inside of a virtual machine on the device. The fundamental Android application model does not change.
Using native code does not result in an automatic performance increase, but always increases application complexity. If you have not run into any limitations using the Android framework APIs, you probably do not need the NDK. Read What is the NDK? for more information about what the NDK offers and whether it will be useful to you.
The NDK is designed for use only in conjunction with the Android SDK. If you have not already installed and setup the Android SDK, please do so before downloading the NDK.
PlatformPackageSizeMD5 Checksum
Windowsandroid-ndk-r6b-windows.zip67670219 bytesf496b48fffb6d341303de170a081b812
Mac OS X (intel)android-ndk-r6b-darwin-x86.tar.bz252798843 bytes65f2589ac1b08aabe3183f9ed1a8ce8e
Linux 32/64-bit (x86)android-ndk-r6b-linux-x86.tar.bz246532436 bytes309f35e49b64313cfb20ac428df4cec2

Revisions

The sections below provide information and notes about successive releases of the NDK, as denoted by revision number.
 Android NDK, Revision 6b (August 2011)
This release of the NDK does not include any new features compared to r6. The r6b release addresses the following issues in the r6 release:
Important bug fixes
  • Fixed the build when APP_ABI="armeabi x86" is used for multi-architecture builds.
  • Fixed the location of prebuilt STLport binaries in the NDK release package. A bug in the packaging script placed them in the wrong location.
  • Fixed atexit() usage in shared libraries with the x86standalone toolchain.
  • Fixed make-standalone-toolchain.sh --arch=x86. It used to fail to copy the proper GNU libstdc++ binaries to the right location.
  • Fixed the standalone toolchain linker warnings about missing the definition and size for the __dso_handle symbol (ARM only).
  • Fixed the inclusion order of $(SYSROOT)/usr/include for x86 builds. See the bug for more information.
  • Fixed the definitions of ptrdiff_t and size_t in x86-specific systems when they are used with the x86 standalone toolchain.
 Android NDK, Revision 5 (December 2010)
 Android NDK, Revision 2 (September 2009)

Installing the NDK

Installing the NDK on your development computer is straightforward and involves extracting the NDK from its download package.
Before you get started make sure that you have downloaded the latest Android SDK and upgraded your applications and environment as needed. The NDK is compatible with older platform versions but not older versions of the SDK tools. Also, take a moment to review the System and Software Requirements for the NDK, if you haven't already.
To install the NDK, follow these steps:
  1. From the table at the top of this page, select the NDK package that is appropriate for your development computer and download the package.
  2. Uncompress the NDK download package using tools available on your computer. When uncompressed, the NDK files are contained in a directory called android-ndk-<version>. You can rename the NDK directory if necessary and you can move it to any location on your computer. This documentation refers to the NDK directory as <ndk>.
You are now ready to start working with the NDK.

Getting Started with the NDK

Once you've installed the NDK successfully, take a few minutes to read the documentation included in the NDK. You can find the documentation in the <ndk>/docs/ directory. In particular, please read the OVERVIEW.HTML document completely, so that you understand the intent of the NDK and how to use it.
If you used a previous version of the NDK, take a moment to review the list of NDK changes in the CHANGES.HTML document.
Here's the general outline of how you work with the NDK tools:
  1. Place your native sources under <project>/jni/...
  2. Create <project>/jni/Android.mk to describe your native sources to the NDK build system
  3. Optional: Create <project>/jni/Application.mk.
  4. Build your native code by running the 'ndk-build' script from your project's directory. It is located in the top-level NDK directory:
    cd <project>
    <ndk>/ndk-build
    
    The build tools copy the stripped, shared libraries needed by your application to the proper location in the application's project directory.
  5. Finally, compile your application using the SDK tools in the usual way. The SDK build tools will package the shared libraries in the application's deployable .apk file.
For complete information on all of the steps listed above, please see the documentation included with the NDK package.

Sample Applications

The NDK includes sample Android applications that illustrate how to use native code in your Android applications. For more information, see Sample Applications.

Discussion Forum and Mailing List

If you have questions about the NDK or would like to read or contribute to discussions about it, please visit the android-ndk group and mailing list.