简体   繁体   中英

Android Studio NDK workaround

I am trying to integrate the NDK project where Android Studio tells me I can have a workaround by:

Warning: Native C/C++ source code is found, but it seems that NDK option is not configured. Note that if you have an Android.mk, it is not used for compilation. The recommended workaround is to remove the default jni source code directory by adding:

 android { sourceSets { main { jni.srcDirs = [] } } } 

to build.gradle, manually compile the code with ndk-build, and then place the resulting shared object in src/main/jniLibs

so after my ndk build, i find that there are two places where I can find .so files in armeabi-v7a,mips and x86 folders

/libs
/obj/local

so which folders from above two contain the actual .so files to be copied?

And do I have to configure anything else to make this work? I imported the project via Android Studio's import ADT method. Thank you!

The suggested workaround assumes that you manually copy the contents of libs directory to src/main/jniLibs .

Alternative workaround is to add the following enchantment to the build.gradle file:

jniLibs.srcDirs = [ 'libs' ]

This line goes together with jni.srcDirs as stated in the message you quote.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM