The Android NDK is a companion tool to the Android SDK that lets you buildperformance-critical portions of your apps in native code. It provides headers andlibraries 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 writenative code, your applications are still packaged into an .apk file and they still runinside of a virtual machine on the device. The fundamental Android application modeldoes 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 limitationsusing the Android framework APIs, you probably do not need the NDK. ReadWhat is the NDK? for more information about whatthe NDK offers and whether it will be useful to you.
The NDK is designed for use only in conjunction with theAndroid SDK. If you have not already installed and setup theAndroid SDK, pleasedo 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 |
The sections below provide information and notes about successive releases ofthe 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:
<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/.docs/opensles/index.html
andhttp://www.khronos.org/opensles/.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, seehttp://ccache.samba.org.
APP_ABI
to all
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 calling ndk-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
LOCAL_CPP_FEATURES
variable in Android.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. See docs/ANDROID-MK.html
and docs/CPLUSPLUS-SUPPORT.html
for more details.$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.ndk-build.cmd
script from the command line from your project path. The script takes exactly the same arguments as the original
ndk-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 thepublic bug database orpublic forum. All samples and unit tests shipped with the NDK succesfully compile with this feature.
libs/<abi>
) ifAPP_MODULES
is not defined in yourApplication.mk
. For example, if a top-level modulefoo
imports a modulebar
, then both libfoo.so
andlibbar.so
are copied to the install location. Previously, onlylibfoo.so
was copied, unless you listed bar
in your APP_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.foo
imports static librarybar
that imports static libraryzoo
, the libfoo.so
will now be linked against bothlibbar.a
and libzoo.a
.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 fromandroid.googlesource.com, which is the new location for the AOSP servers.gabi++
. More details about it are available in the updateddocs/CPLUSPLUS-SUPPORT.html
.gnustl_shared
that corresponds to the shared library version of GNU libstdc++ v3 (GPLv3 license). See more info atdocs/CPLUSPLUS-SUPPORT.html
LOCAL_CPP_EXTENSION
. For example, to compile bothfoo.cpp
andbar.cxx
as C++ sources, declare the following: LOCAL_CPP_EXTENSION := .cpp .cxx
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 witheglGetProcAddress()
or glGetProcAddress()
. The following list describes the newly supported extensions:
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
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_ANDROID_recordable
EGL_NV_system_time