简体   繁体   中英

jniLibs still not working after add folder jniLibs

I use library class that load libsomething.so , also i make everything same as demo (package name).

  1. Actually i'm edited demo project that seem build use old Android Studio (gradle 0.5+)
    Image - Structure of my Project
  2. I'm follow instruction to add Directory "jniLibs" that have same place with /java/main but still reader.java got "Cannot resolve JNI Function"
  3. I'm follow another instruction that set libs as jniLibs, but still reader.java got "Cannot resolve JNI Function".

     sourceSets { main { jni.srcDirs = [] jniLibs.srcDirs = ['libs'] }

    }

  4. i have created package name android.hardware.uhf.magic->reader.java
    Image - class that provided in .so

  5. The way i load library like System.LoadLibrary("something")

Is there any step that i have missed?

Thank You.

What solved it for me was adding an ndk section under android.defaultConfig in my gradle config:

android {
    defaultConfig {
+        ndk { abiFilters "armeabi-v7a" }
    }
}

I don't know any exact answer for your question.But I will try to give you an Answer.

Because I am Use jniLibs too.

sourceSets.main {
        jniLibs.srcDir 'src/main/libs' //set libs as .so's location instead of jni
        jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk file
    }

In Your code I think you Used only "libs" , is that your exact jniLibs path..? if not then give the full path. Also add this Line in your gradle.properties

android.useDeprecatedNdk=true

Hope this helps..(:

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