document source from : http://developer.android.com/sdk/ndk/index.html
Android NDK, Revision 7 (November 2011)
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.
Platform | Package | Size | MD5 Checksum |
---|---|---|---|
Windows | android-ndk-r7-windows.zip | 81270552 bytes | 55483482cf2b75e8dd1a5d9a7caeb6e5 |
Mac OS X (intel) | android-ndk-r7-darwin-x86.tar.bz2 | 71262092 bytes | 817ca5675a1dd44078098e43070f19b6 |
Linux 32/64-bit (x86) | android-ndk-r7-linux-x86.tar.bz2 | 64884365 bytes | bf15e6b47bf50824c4b96849bf003ca3 |
Revisions
The sections below provide information and notes about successive releases of the NDK, as denoted by revision number.

This release of the NDK includes new features to support the Android 4.0 platform as well as many other additions and improvements:
- New features
-
- Added official NDK APIs for Android 4.0 (API level 14), which adds the following native features to the platform:
- Added native multimedia API based on the Khronos Group OpenMAX AL™ 1.0.1 standard. The new
<OMXAL/OpenMAXAL.h>
and<OMXAL/OpenMAXAL_Android.h>
headers allow applications targeting API level 14 to perform multimedia output directly from native code by using a new Android-specific buffer queue interface. For more details, seedocs/openmaxal/index.html
and http://www.khronos.org/openmax/. - Updated the native audio API based on the Khronos Group OpenSL ES 1.0.1™ standard. With API Level 14, you can now decode compressed audio (e.g. MP3, AAC, Vorbis) to PCM. For more details, see
docs/opensles/index.html
andhttp://www.khronos.org/opensles/.
- Added native multimedia API based on the Khronos Group OpenMAX AL™ 1.0.1 standard. The new
- Added CCache support. To speed up large rebuilds, define the
NDK_CCACHE
environment variable toccache
(or the path to yourccache
binary). When declared, the NDK build system automatically uses CCache when compiling any source file. For example:export NDK_CCACHE=ccache
Note: CCache is not included in the NDK release so you must have it installed prior to using it. For more information about CCache, see http://ccache.samba.org.
- Added support for setting
APP_ABI
toall
to indicate that you want to build your NDK modules for all the ABIs supported by your given NDK release. This means that either one of the following two lines in yourApplication.mk
are equivalent with this release:APP_ABI := all APP_ABI := armeabi armeabi-v7a x86
This also works if you define
APP_ABI
when callingndk-build
from the command-line, which is a quick way to check that your project builds for all supported ABIs without changing the project’sApplication.mk file
. For example:ndk-build APP_ABI=all
- Added a
LOCAL_CPP_FEATURES
variable inAndroid.mk
that allows you to declare which C++ features (RTTI or Exceptions) your module uses. This ensures that the final linking works correctly if you have prebuilt modules that depend on these features. Seedocs/ANDROID-MK.html
anddocs/CPLUSPLUS-SUPPORT.html
for more details. - Shortened paths to source and object files that are used in build commands. When invoking
$NDK/ndk-build
from your project path, the paths to the source, object, and binary files that are passed to the build commands are significantly shorter now, because they are passed relative to the current directory. This is useful when building projects with a lot of source files, to avoid limits on the maximum command line length supported by your host operating system. The behavior is unchanged if you invokendk-build
from a sub-directory of your project tree, or if you defineNDK_PROJECT_PATH
to point to a specific directory.
- Added official NDK APIs for Android 4.0 (API level 14), which adds the following native features to the platform:
- Experimental features
- You can now build your NDK source files on Windows without Cygwin by calling the
ndk-build.cmd
script from the command line from your project path. The script takes exactly the same arguments as the originalndk-build
script. The Windows NDK package comes with its own prebuilt binaries for GNU Make, Awk and other tools required by the build. You should not need to install anything else to get a working build system.Important:ndk-gdb
does not work on Windows, so you still need Cygwin to debug.This feature is still experimental, so feel free to try it and report issues on the public bug database or public forum. All samples and unit tests shipped with the NDK succesfully compile with this feature. - Important bug fixes
-
- Imported shared libraries are now installed by default to the target installation location (
libs/<abi>
) ifAPP_MODULES
is not defined in yourApplication.mk
. For example, if a top-level modulefoo
imports a modulebar
, then bothlibfoo.so
andlibbar.so
are copied to the install location. Previously, onlylibfoo.so
was copied, unless you listedbar
in yourAPP_MODULES
too. If you defineAPP_MODULES
explicitly, the behavior is unchanged. ndk-gdb
now works correctly for activities with multiple categories in their MAIN intent filters.- Static library imports are now properly transitive. For example, if a top-level module
foo
imports static librarybar
that imports static libraryzoo
, thelibfoo.so
will now be linked against bothlibbar.a
andlibzoo.a
.
- Imported shared libraries are now installed by default to the target installation location (
- Other changes
-
docs/NATIVE-ACTIVITY.HTML
: Fixed typo. The minimum API level should be 9, not 8 for native activities.docs/STABLE-APIS.html
: Added missing documentation listing EGL as a supported stable API, starting from API level 9.download-toolchain-sources.sh
: Updated to download the toolchain sources from android.googlesource.com, which is the new location for the AOSP servers.- Added a new C++ support runtime named
gabi++
. More details about it are available in the updateddocs/CPLUSPLUS-SUPPORT.html
. - Added a new C++ support runtime named
gnustl_shared
that corresponds to the shared library version of GNU libstdc++ v3 (GPLv3 license). See more info atdocs/CPLUSPLUS-SUPPORT.html
- Added support for RTTI in the STLport C++ runtimes (no support for exceptions).
- Added support for multiple file extensions in
LOCAL_CPP_EXTENSION
. For example, to compile bothfoo.cpp
andbar.cxx
as C++ sources, declare the following:LOCAL_CPP_EXTENSION := .cpp .cxx
- Removed many unwanted exported symbols from the link-time shared system libraries provided by the NDK. This ensures that code generated with the standalone toolchain doesn’t risk to accidentally depend on a non-stable ABI symbol (e.g. any libgcc.a symbol that changes each time the toolchain used to build the platform is changed)
- Refreshed the EGL and OpenGLES Khronos headers to support more extensions. Note that this does not change the NDK ABIs for the corresponding libraries, because each extension must be probed at runtime by the client application.The extensions that are available depend on your actual device and GPU drivers, not the platform version the device runs on. The header changes simply add new constants and types to make it easier to use the extensions when they have been probed with
eglGetProcAddress()
orglGetProcAddress()
. The following list describes the newly supported extensions:- GLES 1.x
-
GL_OES_vertex_array_object
GL_OES_EGL_image_external
GL_APPLE_texture_2D_limited_npot
GL_EXT_blend_minmax
GL_EXT_discard_framebuffer
GL_EXT_multi_draw_arrays
GL_EXT_read_format_bgra
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_lod_bias
GL_IMG_read_format
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_env_enhanced_fixed_function
GL_IMG_user_clip_plane
GL_IMG_multisampled_render_to_texture
GL_NV_fence
GL_QCOM_driver_control
GL_QCOM_extended_get
GL_QCOM_extended_get2
GL_QCOM_perfmon_global_mode
GL_QCOM_writeonly_rendering
GL_QCOM_tiled_rendering
- GLES 2.0
-
GL_OES_element_index_uint
GL_OES_get_program_binary
GL_OES_mapbuffer
GL_OES_packed_depth_stencil
GL_OES_texture_3D
GL_OES_texture_float
GL_OES_texture_float_linear
GL_OES_texture_half_float_linear
GL_OES_texture_npot
GL_OES_vertex_array_object
GL_OES_EGL_image_external
GL_AMD_program_binary_Z400
GL_EXT_blend_minmax
GL_EXT_discard_framebuffer
GL_EXT_multi_draw_arrays
GL_EXT_read_format_bgra
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_compression_dxt1
GL_IMG_program_binary
GL_IMG_read_format
GL_IMG_shader_binary
GL_IMG_texture_compression_pvrtc
GL_IMG_multisampled_render_to_texture
GL_NV_coverage_sample
GL_NV_depth_nonlinear
GL_QCOM_extended_get
GL_QCOM_extended_get2
GL_QCOM_writeonly_rendering
GL_QCOM_tiled_rendering
- EGL
-
EGL_ANDROID_recordable
EGL_NV_system_time