Android Studio NDK compiling
The first step:
in the Main set up below JNI folder: The relevant files are put in.
Step Two:
App/build.gradle below
Add code:
NDK {
modulename "App"//<--This is the name of my C + + module!
cFlags "-DANDROID_NDK"//Define some macros
ldlibs "EGL", "GLESv3", "DL", "Log" //Link with these libraries!
STL "Stlport_shared"
}
Specific as follows:
Step Three:
in the local.properties in the file Configure The path to the local NDK, such as mine:
ndk.dir=/users/cinba/library/android-ndk-r10e
Sdk.dir=/users/cinba/library/android-sdk
Fourth Step:
then build-> make Project , So the file is ready to be created;
location in directory app/build/intermediates/ndk/ below;
Fifth Step:
will generate a good So file Copy to our Jnilibs folder can be;
Add:
This configuration will automatically edit the C file every time, if not every time the NDK compiled the words, gradle in the NDK configuration commented out, and so file copy into our jnilibs! encounteredQuestion: make.exe: * * * No rule to make target ' D:\AndroidStudioProjects\project\app\build\intermediates\ndk\umeng\debug\ Obj/local/arm64-v8a/objs/app/d_\androidstudioprojects\project\app\src\main\jni ', needed by ' D:\ Androidstudioprojects\project\app\build\intermediates\ndk\umeng\debug\obj/local/arm64-v8a/objs/app/d_\ ANDROIDSTUDIOPROJECTS\PROJECT\APP\SRC\MAIN\JNI\TAG.O '. Stop. In Windows NDK A bug that occurs when only one file is compiled, the workaround isadd an empty util.c file to the Jni folderCan issue reference: http://blog.csdn.net/sodino/article/details/41946607
Android Studio Compiling NDK