Before installing the Android NDK, you must agree to the following terms and conditions.
1.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google APIs add-ons) is licensed to you subject to the terms of this License Agreement. This License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK. 1.2 “Android” means the Android software stack for devices, as made available under the Android Open Source Project, which is located at the following URL: http://source.android.com/, as updated from time to time. 1.3 "Google" means Google Inc., a Delaware corporation with principal place of business at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States.
2.1 In order to use the SDK, you must first agree to this License Agreement. You may not use the SDK if you do not accept this License Agreement. 2.2 By clicking to accept, you hereby agree to the terms of this License Agreement. 2.3 You may not use the SDK and may not accept the License Agreement if you are a person barred from receiving the SDK under the laws of the United States or other countries including the country in which you are resident or from which you use the SDK. 2.4 If you are agreeing to be bound by this License Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to this License Agreement. If you do not have the requisite authority, you may not accept the License Agreement or use the SDK on behalf of your employer or other entity.
3.1 Subject to the terms of this License Agreement, Google grants you a limited, worldwide, royalty-free, non-assignable and non-exclusive license to use the SDK solely to develop applications to run on the Android platform. 3.2 You agree that Google or third parties own all legal right, title and interest in and to the SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, and any and all other proprietary rights. Google reserves all rights not expressly granted to you. 3.3 You may not use the SDK for any purpose not expressly permitted by this License Agreement. Except to the extent required by applicable third party licenses, you may not: (a) copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK; or (b) load any part of the SDK onto a mobile handset or any other hardware device except a personal computer, combine any part of the SDK with other software, or distribute any software or device incorporating a part of the SDK. 3.4 You agree that you will not take any actions that may cause or result in the fragmentation of Android, including but not limited to distributing, participating in the creation of, or promoting in any way a software development kit derived from the SDK. 3.5 Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not this License Agreement. 3.6 You agree that the form and nature of the SDK that Google provides may change without prior notice to you and that future versions of the SDK may be incompatible with applications developed on previous versions of the SDK. You agree that Google may stop (permanently or temporarily) providing the SDK (or any features within the SDK) to you or to users generally at Google's sole discretion, without prior notice to you. 3.7 Nothing in this License Agreement gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, or other distinctive brand features. 3.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the SDK.
4.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under this License Agreement in or to any software applications that you develop using the SDK, including any intellectual property rights that subsist in those applications. 4.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) this License Agreement and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries). 4.3 You agree that if you use the SDK to develop applications for general public users, you will protect the privacy and legal rights of those users. If the users provide you with user names, passwords, or other login information or personal information, you must make the users aware that the information will be available to your application, and you must provide legally adequate privacy notice and protection for those users. If your application stores personal or sensitive information provided by users, it must do so securely. If the user provides your application with Google Account information, your application may only use that information to access the user's Google Account when, and for the limited purposes for which, the user has given you permission to do so. 4.4 You agree that you will not engage in any activity with the SDK, including the development or distribution of an application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the servers, networks, or other properties or services of any third party including, but not limited to, Google or any mobile communications carrier. 4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any data, content, or resources that you create, transmit or display through Android and/or applications for Android, and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so. 4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any breach of your obligations under this License Agreement, any applicable third party contract or Terms of Service, or any applicable law or regulation, and for the consequences (including any loss or damage which Google or any third party may suffer) of any such breach.
5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Google or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials.
6.1 In order to continually innovate and improve the SDK, Google may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the SDK are being used and how they are being used. Before any of this information is collected, the SDK will notify you and seek your consent. If you withhold consent, the information will not be collected. 6.2 The data collected is examined in the aggregate to improve the SDK and is maintained in accordance with Google's Privacy Policy.
7.1 If you use the SDK to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Google is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Google is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources. 7.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners. 7.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party. In that case, this License Agreement does not affect your legal relationship with these third parties.
8.1 Google Data APIs 8.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be protected by intellectual property rights which are owned by Google or those parties that provide the data (or by other persons or companies on their behalf). Your use of any such API may be subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or create derivative works based on this data (either in whole or in part) unless allowed by the relevant Terms of Service. 8.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you shall retrieve data only with the user's explicit consent and only when, and for the limited purposes for which, the user has given you permission to do so.
9.1 This License Agreement will continue to apply until terminated by either you or Google as set out below. 9.2 If you want to terminate this License Agreement, you may do so by ceasing your use of the SDK and any relevant developer credentials. 9.3 Google may at any time, terminate this License Agreement with you if: (A) you have breached any provision of this License Agreement; or (B) Google is required to do so by law; or (C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated its relationship with Google or ceased to offer certain parts of the SDK to you; or (D) Google decides to no longer provide the SDK or certain parts of the SDK to users in the country in which you are resident or from which you use the service, or the provision of the SDK or certain SDK services to you by Google is, in Google's sole discretion, no longer commercially viable. 9.4 When this License Agreement comes to an end, all of the legal rights, obligations and liabilities that you and Google have benefited from, been subject to (or which have accrued over time whilst this License Agreement has been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall continue to apply to such rights, obligations and liabilities indefinitely.
10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE. 10.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. 10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.
12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless Google, its affiliates and their respective directors, officers, employees and agents from and against any and all claims, actions, suits or proceedings, as well as any and all losses, liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of any person or defames any person or violates their rights of publicity or privacy, and (c) any non-compliance by you with this License Agreement.
13.1 Google may make changes to the License Agreement as it distributes new versions of the SDK. When these changes are made, Google will make a new version of the License Agreement available on the website where the SDK is made available.
14.1 This License Agreement constitutes the whole legal agreement between you and Google and governs your use of the SDK (excluding any services which Google may provide to you under a separate written agreement), and completely replaces any prior agreements between you and Google in relation to the SDK. 14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in this License Agreement (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google. 14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of this License Agreement is invalid, then that provision will be removed from this License Agreement without affecting the rest of this License Agreement. The remaining provisions of this License Agreement will continue to be valid and enforceable. 14.4 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to this License Agreement and that such other companies shall be entitled to directly enforce, and rely upon, any provision of this License Agreement that confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to this License Agreement. 14.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE. 14.6 The rights granted in this License Agreement may not be assigned or transferred by either you or Google without the prior written approval of the other party. Neither you nor Google shall be permitted to delegate their responsibilities or obligations under this License Agreement without the prior written approval of the other party. 14.7 This License Agreement, and your relationship with Google under this License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from this License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction. November 13, 2012
I have read and agree with the above terms and conditions
The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++. For certain types of apps, this can be helpful so you can reuse existing code libraries written in these languages, but most apps do not need the Android NDK.
Before downloading the NDK, you should understand that the NDK will not benefit most apps. As a developer, you need to balance its benefits against its drawbacks. Notably, using native code on Android generally does not result in a noticable performance improvement, but it always increases your app complexity. In general, you should only use the NDK if it is essential to your app—never because you simply prefer to program in C/C++.
Typical good candidates for the NDK are CPU-intensive workloads such as game engines, signal processing, physics simulation, and so on. When examining whether or not you should develop in native code, think about your requirements and see if the Android framework APIs provide the functionality that you need.
With NDK revision 9 and higher, the release packages have been split to reduce download size. The first download for each platform contains the default NDK toolchain. The second download contains legacy NDK toolchains for that platform, which is only required if you are not using the current, recommended toolchain for your NDK builds.
The following sections provide information about releases of the NDK.
Android NDK, Revision 9d (March 2014)
TARGET_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1 TARGET_LDFLAGS += -Wl,--no-warn-mismatch -lm_hard
android/tts.h EGL/eglext.h fts.h GLES/glext.h GLES2/gl2ext.h OMXAL/OpenMAXSL_Android.h SLES/OpenSLES_Android.h sys/prctl.h sys/utime.h
Android NDK, Revision 9c (December 2013)
This is a bug-fix-only release.
cc1: internal compiler error: in common_handle_option, at opts.c:1774
I/DEBUG ( 1151): #00 5f09db68 401f01c4 /system/lib/libc.so
APP_ABI := "armeabi,armeabi-v7a"
Android NDK, Revision 9b (October 2013)
GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
internal compiler error: verify_flow_info failed
external/icu4c/i18n/decimfmt.cpp:1322:1: internal compiler error: in dbx_reg_number, at dwarf2out.c:10185
LOCAL_CFLAGS += -fopenmp LOCAL_LDFLAGS += -fopenmp
Android NDK, Revision 9 (July 2013)
Note: The -Wunused-local-typedefs option is enabled by -Wall . Be sure to add __attribute__((unused)) if you use compile-time asserts like sources/cxx-stl/stlport/stlport/stl/config/features.h , line #311. For more information, see Change 55460
Note: In the GCC 4.7 release and later, ARM compilers generate unaligned access code by default for ARMv6 and higher build targets. You may need to add the -mno-unaligned-access build option when building for kernels that do not support this feature.
clang: for the -arm-enable-ehabi option: may only occur zero or one times!
Android NDK, Revision 8e (March 2013)
Android NDK, Revision 8d (December 2012)
--toolchain=arm-linux-androideabi-4.7
Note: This feature is experimental. Please try it and report any issues.
Note: This feature is experimental and works better with the GCC 4.6/4.7 compilers than with GCC 4.4.3 or Clang 3.1. Please try it and report any issues.
dyld: lazy symbol binding failed: Symbol not found: _memmem Referenced from: . /arm-linux-androideabi/bin/ld Expected in: /usr/lib/libSystem.B.dylib
Android NDK, Revision 8c (November 2012)
Note: This feature is experimental. Please try it and report any issues.
./build/tools/make-release.sh --force --systems=linux-x86extern "C"
/arm-linux-androideabi/include/c++/4.6.x-google to: /include/c++/4.6/
static const struct < int32_t namesz; /* = 8, sizeof ("Android") */ int32_t descsz; /* = 1 * sizeof(int32_t) */ int32_t type; /* = 1, ABI_NOTETYPE */ char name[sizeof "Android"]; /* = "Android" */ int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */ >
Android NDK, Revision 8b (July 2012)
The main features of this release are a new GNU Compiler Collection (GCC) 4.6 toolchain and GNU Debugger (GDB) 7.3.x which adds debugging support for the Android 4.1 (API Level 16) system image.
LOCAL_DISABLE_NO_EXECUTE=true # disable "--noexecstack" and "-z noexecstack" DISABLE_RELRO=true # disable "-z relro" and "-z now"
See docs/ANDROID-MK.html for more details.
static const struct < int32_t namesz; /* = 4, sizeof ("GNU") */ int32_t descsz; /* = 6 * sizeof(int32_t) */ int32_t type; /* = 1 */ char name[sizeof "GNU"]; /* = "GNU" */ int32_t os; /* = 0 */ int32_t major; /* = 2 */ int32_t minor; /* = 6 */ int32_t teeny; /* = 15 */ int32_t os_variant; /* = 1 */ int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */ >
Android NDK, Revision 8 (May 2012)
This release of the NDK includes support for MIPS ABI and a few additional fixes.
APP_ABI := armeabi armeabi-v7a mips
Note: To ensure that your applications are available to users only if their devices are capable of running them, Google Play filters applications based on the instruction set information included in your application ? no action is needed on your part to enable the filtering. Additionally, the Android system itself also checks your application at install time and allows the installation to continue only if the application provides a library that is compiled for the device's CPU architecture.
Android NDK, Revision 7c (April 2012)
This release of the NDK includes an important fix for Tegra2-based devices, and a few additional fixes and improvements:
Android NDK, Revision 7b (February 2012)
This release of the NDK includes fixes for native Windows builds, Cygwin and many other improvements:
Android NDK, Revision 7 (November 2011)
This release of the NDK includes new features to support the Android 4.0 platform as well as many other additions and improvements:
export NDK_CCACHE=ccache
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's Application.mk file . For example:
ndk-build APP_ABI=all
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.
LOCAL_CPP_EXTENSION := .cpp .cxx
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:
Android NDK, Revision 6 (July 2011)
This release of the NDK includes support for the x86 ABI and other minor changes. For detailed information describing the changes in this release, read the CHANGES.HTML document included in the NDK package.
APP_ABI := armeabi armeabi-v7a x86
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:
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);
Android NDK, Revision 5b (January 2011)
This release of the NDK does not include any new features compared to r5. The r5b release addresses the following problems in the r5 release:
Android NDK, Revision 5 (December 2010)
This release of the NDK includes many new APIs, most of which are introduced to support the development of games and similar applications that make extensive use of native code. Using the APIs, developers have direct native access to events, audio, graphics and window management, assets, and storage. Developers can also implement the Android application lifecycle in native code with help from the new NativeActivity class. For detailed information describing the changes in this release, read the CHANGES.HTML document included in the downloaded NDK package.
Android NDK, Revision 4b (June 2010)
NDK r4b notes:Includes fixes for several issues in the NDK build and debugging scripts — if you are using NDK r4, we recommend downloading the NDK r4b build. For detailed information describing the changes in this release, read the CHANGES.TXT document included in the downloaded NDK package.
Android NDK, Revision 3 (March 2010)
Android NDK, Revision 2 (September 2009)
Originally released as "Android 1.6 NDK, Release 1".
Android NDK, Revision 1 (June 2009)
Originally released as "Android 1.5 NDK, Release 1".
The sections below describe the system and software requirements for using the Android NDK, as well as platform compatibility considerations that affect appplications using libraries produced with the NDK.
Native Code CPU Architecture Used | Compatible Android Platform(s) |
---|---|
ARM, ARM-NEON | Android 1.5 (API Level 3) and higher |
x86 | Android 2.3 (API Level 9) and higher |
MIPS | Android 2.3 (API Level 9) and higher |
OpenGL ES Version Used | Compatible Android Platform(s) | Required uses-sdk Attribute |
---|---|---|
OpenGL ES 1.1 | Android 1.6 (API Level 4) and higher | android:minSdkVersion="4" |
OpenGL ES 2.0 | Android 2.0 (API Level 5) and higher | android:minSdkVersion="5" |
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:
You are now ready to start working 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 /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:
cd /ndk-build
For complete information on all of the steps listed above, please see the documentation included with the NDK package.
The Android framework provides two ways to use native code:
The NDK contains the APIs, documentation, and sample applications that help you write your native code. Specifically:
The latest release of the NDK supports the following instruction sets:
ARMv5TE machine code will run on all ARM-based Android devices. ARMv7-A will run only on devices such as the Verizon Droid or Google Nexus One that have a compatible CPU. The main difference between the two instruction sets is that ARMv7-A supports hardware FPU, Thumb-2, and NEON instructions. You can target either or both of the instruction sets — ARMv5TE is the default, but switching to ARMv7-A is as easy as adding a single line to the application's Application.mk file, without needing to change anything else in the file. You can also build for both architectures at the same time and have everything stored in the final .apk . Complete information is provided in the CPU-ARCH-ABIS.HTML in the NDK package.
The NDK provides stable headers for libc (the C library), libm (the Math library), OpenGL ES (3D graphics library), the JNI interface, and other libraries, as listed in the Development tools section.
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:
The NDK also provides a build system that lets you work efficiently with your sources, without having to handle the toolchain/platform/CPU/ABI details. You create very short build files to describe which sources to compile and which Android application will use them — the build system compiles the sources and places the shared libraries directly in your application project.
Important: With the exception of the libraries listed above, native system libraries in the Android platform are not stable and may change in future platform versions. Your applications should only make use of the stable native system libraries provided in this NDK.
The NDK package includes a set of documentation that describes the capabilities of the NDK and how to use it to create shared libraries for your Android applications. In this release, the documentation is provided only in the downloadable NDK package. You can find the documentation in the /docs/ directory. Included are these files (partial listing):
Additionally, the package includes detailed information about the "bionic" C library provided with the Android platform that you should be aware of, if you are developing using the NDK. You can find the documentation in the /docs/system/libc/ directory:
The NDK includes sample applications that illustrate how to use native code in your Android applications:
For each sample, the NDK includes the corresponding C source code and the necessary Android.mk and Application.mk files. There are located under /samples// and their source code can be found under /samples//jni/ .
You can build the shared libraries for the sample apps by going into /samples// then calling the ndk-build command. The generated shared libraries will be located under /samples//libs/armeabi/ for (ARMv5TE machine code) and/or /samples//libs/armeabi-v7a/ for (ARMv7 machine code).
Next, build the sample Android applications that use the shared libraries:
For more information about developing with the Android SDK tools and what you need to do to create, build, and run your applications, see the Overview section for developing on Android.
The hello-jni sample is a simple demonstration on how to use JNI from an Android application. The HelloJni activity receives a string from a simple C function and displays it in a TextView.
The main components of the sample include:
android update project -p . -s
cd /samples/hello-jni /ndk-build
ant debug adb install bin/HelloJni-debug.apk
When you run the application on the device, the string Hello JNI should appear on your device. You can explore the rest of the samples that are located in the /samples directory for more examples on how to use the JNI.
The native-activity sample provided with the Android NDK demonstrates how to use the android_native_app_glue static library. This static library makes creating a native activity easier by providing you with an implementation that handles your callbacks in another thread, so you do not have to worry about them blocking your main UI thread. The main parts of the sample are described below:
To build this sample application:
android update project -p . -s
cd /platforms/samples/android-9/samples/native-activity /ndk-build
ant debug adb install bin/NativeActivity-debug.apk
Except as noted, this content is licensed under Creative Commons Attribution 2.5. For details and restrictions, see the Content License.