Android NDK java.lang.UnsatisfiedLinkError: findLibrary returned null

后端 未结 16 512
我在风中等你
我在风中等你 2020-11-30 01:56

Having the above error in your Android JNI app? Read on...

Up front, I\'ll say that I\'ve already solved this, in my own way, but I feel something in the Android bu

相关标签:
16条回答
  • 2020-11-30 02:13

    No need to root the device..deploy app on emulator and browse the folder

    0 讨论(0)
  • 2020-11-30 02:18

    Add this following code inside your gradle file

    //libs is the location of your library's folder, It varies in diffarent projects like src/main/libs etc.
    android {
      sourceSets.main {
        jniLibs.srcDir 'libs'
      }
    }
    

    So, Android Studio keep on looking native libs inside jniLibs folder. this code will change the path of android studio to look libs in libs folder

    0 讨论(0)
  • 2020-11-30 02:20

    If you have a native project with "libXYZ.so", make sure that /system/lib/libXYZ.so does not exist on your device. There is a painful workaround: use

    System.load("/data/data/your.package.name/lib/libXY.so") 
    

    instead of System.loadLibrary().

    0 讨论(0)
  • 2020-11-30 02:20

    UnsatisfiedLinkerror is solved by this.Build your .so file again by "ndk_build"

    0 讨论(0)
  • 2020-11-30 02:22

    If you are trying to run your app in a simulator, then make sure that you have specified the correct architecture in Run -> Run Configurations -> Target (you may need to add the required simulator using Window -> Android Virtual Device Manager).

    I had the same problem when trying to execute an app in an Intel simulator, while the app was using a library precompiled for the ARM.

    0 讨论(0)
  • 2020-11-30 02:22

    In my case, while making a System Application the issue was related to permissions. After putting the ".so" files into /system/lib/ or /system/vendor/lib/ directory, I modified the default allocated permissions 600 to 755. It worked well.

    0 讨论(0)
提交回复
热议问题