简体   繁体   中英

How can I implement JniLibs in android studio

I want to use JniLibs in my application. I have added a folder jniLibs under app/src/main. The folder jniLibs contains armeabi, armeabi-v7a, x86 and these folder contains .so files.

I have written the below code in build.gradle file:

sourceSets.main {
    jniLibs.srcDir 'libs'
    jni.srcDirs = [] //disable automatic ndk-build call
}

When I run my application is says : No implementation found for native.

I am new in implementing jniLibs in android studio, can you please help me. Thank you so much in advance for your help.

What is name of jni: "jni" or "jniLibs" ? you need add:

sourceSets.main {
    jni.srcDirs = []
    jniLibs.srcDir 'src/main/<name jni folder>'
}

If you have c file you need compile it: http://ph0b.com/new-android-studio-ndk-support/

Remove the sourcesets lines. You dont need it. Because it is already defined as default.

Create a directory to your

Module (app for example) - > src -> main -> jniLibs

And you can put your .so files to in that folder.

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