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.
Platform | Package | Size | MD5 Checksum |
---|---|---|---|
Windows | android-ndk-r5c-windows.zip | 61627716 bytes | 2c7423842fa0f46871eab118495d4b45 |
Mac OS X (intel) | android-ndk-r5c-darwin-x86.tar.bz2 | 50714712 bytes | 183bfbbd85cf8e4c0bd7531e8803e75d |
Linux 32/64-bit (x86) | android-ndk-r5c-linux-x86.tar.bz2 | 44539890 bytes | 7659dfdc97026ed1d913e224d0531f61 |
Revisions
The sections below provide information and notes about successive releases of the NDK, as denoted by revision number.
Android NDK, Revision 5c (June 2011)
This release of the NDK does not include any new features compared to r5b. The r5c release addresses the following problems in the r5b release:
- Important bug fixes:
ndk-build
: Fixed a rare bug that appeared when trying to perform parallel builds of debuggable projects.- Fixed a typo that prevented
LOCAL_WHOLE_STATIC_LIBRARIES
to work correctly with the new toolchain and added documentation for this indocs/ANDROID-MK.html
. - Fixed a bug where code linked against
gnustl_static
crashed when run on platform releases older than API level 8 (Android 2.2). ndk-gdb
: Fixed a bug that caused a segmentation fault when debugging Android 3.0 or newer devices.<android/input.h>
: Two functions that were introduced in API level 9 (Android 2.3) were incorrect and are fixed. While this breaks the source API, the binary interface to the system is unchanged. The incorrect functions were missing ahistory_index
parameter, and the correct definitions are shown below:float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, size_t history_index);
- Updated the C library ARM binary for API level 9 (Android 2.3) to correctly expose at link time new functions that were added in that API level (for example,
pthread_rwlock_init
).
- Minor improvements and fixes:
- Object files are now always linked in the order they appear in
LOCAL_SRC_FILES
. This was not the case previously because the files were grouped by source extensions instead. - When
import-module
fails, it now prints the list of directories that were searched. This is useful to check that theNDK_MODULE_PATH
definition used by the build system is correct. - When
import-module
succeeds, it now prints the directory where the module was found to the log (visible withNDK_LOG=1
). - Increased the build speed of debuggable applications when there is a very large number of include directories in the project.
ndk-gdb
: Better detection ofadb shell
failures and improved error messages.<pthread.h>
: Fixed the definition ofPTHREAD_RWLOCK_INITIALIZER
for API level 9 (Android 2.3) and higher.- Fixed an issue where a module could import itself, resulting in an infinite loop in GNU Make.
- Fixed a bug that caused the build to fail if
LOCAL_ARM_NEON
was set to true (typo inbuild/core/build-binary.mk
). - Fixed a bug that prevented the compilation of .s assembly files (
.S
files were okay).
- Object files are now always linked in the order they appear in
Android NDK, Revision 5b (January 2011)
Android NDK, Revision 5 (December 2010)
Android NDK, Revision 4b (June 2010)
Android NDK, Revision 3 (March 2010)
Android NDK, Revision 2 (September 2009)
Android NDK, Revision 1 (June 2009)