First, the NDK analysis:
The Android platform has supported C and C + + development since its inception. As we all know, the Android SDK is based on Java implementations, which means that third-party apps that are developed based on the Android SDK must use the Java language. But this is not the same as "third-party apps can only use Java." When the Android SDK was first released, Google announced that its virtual machine Dalvik supported JNI programming, which means that third-party applications could call their own C dynamic library through JNI, i.e., on Android, the "java+c" programming is always possible.
However, Google also said that the use of Native SDK programming compared to the Dalvik virtual machine has some disadvantages, the Android SDK documentation, no JNI help found. Even if third-party application developers use JNI to complete their own C dynamic-link library (SO) development, how so is packaged with the app as an APK and released? There are also technical barriers in this. For example, the program is more complex, compatibility is difficult to protect, unable to access the framework api,debug more difficult and so on. Developers need to use them at their own discretion.
So the NDK was born. The NDK full name is native development Kit.
The release of the NDK enabled the development of "Java+c" to become officially supported by the official development approach. The NDK will be the beginning of the Android platform to support c development.
Second, download and unzip:
Http://developer.android.com/tools/sdk/ndk/index.html
Official website method: Decompression with "./***"
ndk$ chmod a+x Android-ndk-r10c-Darwin-x86_64. Bin
./Android-ndk-r10c-Darwin-x86_64. Bin
Three, MAC installation configuration environment:
Unzip, copy to a directory dedicated to custom run files, for example, Mac built Users/yourname/bin directory
Export PATH=${PATH}:/USERS/JARRAHWU/DOCUMENTS/ANDROID-NDK-R10D//
A_NDK_ROOT=/USERS/LIAN***UAN/BIN/ANDROID-NDK-R10D//
Export A_ndk_root
Iv. modifying Local.properties in the Android studio project
Sdk.dir=/applications/android STUDIO.APP/SDK//write your own SDK and NDK path
Ndk.dir=/users/liang***uan/bin/ndk
When it's not the wrong time to install the NDK times:
Error:execution failed for task ': App:compiledebugndk '.
> NDK Not Configured.
Download the NDK from http://developer.android.com/tools/sdk/ndk/.
Then add NDK.DIR=PATH/TO/NDK in "Local.properties". This way, it even teaches you where to add it.
(on Windows, make sure you escape backslashes, e.g. C:\\NDK rather than C:\NDK)
RELATED links:
http://developer.android.com/tools/sdk/ndk/index.html//Official website and installation method, but configuration. Bash_profile need to refer to the following document
http://www.cnblogs.com/jarrah/archive/2013/03/15/2961892.html//mac under Installation
http://www.cnblogs.com/devinzhang/archive/2012/02/29/2373729.html//Explain what the NDK is, why use the NDK
ANDROID+NDK+MAC Installation