Android NDK Environment Setup

Source: Internet
Author: User

Using the latest NDK, directly discard Cygwin, previously done Android projects to use the NDK must download the NDK, download install Cygwin (for simulation of the Linux environment), download the CDT (Eclipse C + + development plug-in), also configure the compiler, environment variables, Special Trouble, the new version will not need

Steps:

First, The Android website downloads the Android development Tool ADT (abbreviated for Android development tool), which integrates the latest ADT and NDK plugins as well as Eclipse, and also has a latest version of the SDK. You can use it after you unzip it.

Second, ADT Plugins: Managing the Android SDK and related development tools

NDK Plugin: Plugin for development of Android NDK, ADT version above 20, can install NDK plug-in, and the NDK integrates the CDT plugin

Download Link interview: http://developer.android.com/sdk/index.html

Third, Download the latest NDK on the Android website, note: The NDK version integrates Cygwin after R7 and is a very lite version.

Download Link interview: http://developer.android.com/tools/sdk/ndk/index.html


Eclipse Configuration:
1.open Eclipse, point window->preferences->android->ndk, set the NDK path, for example Shamoo is E:\android-ndk-r9c



2.Create a new Android project, right-click on the Android Tools->add Native support ..., and then give us a name for the. So file, for example: My-ndk



3.at this time the project will be more than one Jni folder, JNI under the Android.mk and My-ndk.cpp files. Android.mk is the makefile,my-ndk.cpp of the NDK project, which is the source file of the NDK.

4.then write about the NDK Demo,hello-jni project. Use ALT + '/' to code hints! It's cool! Have you got any wood? Before using the CDT time or death can not press the code hint, depressed ...

5.the naming specification for the JNI interface is: Java_ + Call the method's package name (the point of the package name is replaced with _) + _ + Call the interface's class name + _ + method name, for instance method, there are two parameters is necessary, a JNI environment pointer jnienv *




6.finished, and then run. Compile the NDK before running, and then compile the Java code. Compilation may encounter unable to launch Cygpath. is Cygwin on the path? How to fix it? as follows

7.Project Right-click the building settings in the point properties->c/c++ build to remove the Use default Build command and enter ${ndkroot}/ndk-build.cmd




8.Click on Environment in the C + + build, click Add ... Add environment variable Ndkroot, the value of the NDK root directory


Android NDK Environment Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.