Android Studio Compiling NDK

Source: Internet
Author: User

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

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.