UnsatisfiedLinkError on Samsung S6

I have an Android project (not ndk). In this project, I link my own native library myLib.so. I have compiled my library for: armeabi-v7a and x86. Therefore, in the jniLibs folder, I have two folders with my lib: armeabi-v7a, x86.

When a user launches my application on the Samsung S6, I have the following crash log:

> java.lang.UnsatisfiedLinkError: > dalvik.system.PathClassLoader[DexPathList[[zip file > "/data/app/com.mycompany.test-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.test-2/lib/arm64, > /vendor/lib64, /system/lib64]]] > couldn't find "myLib.so" at java.lang.Runtime.loadLibrary(Runtime.java:366) at > java.lang.System.loadLibrary(System.java:989) 

What's happening? why does a 64-bit device not work with my library?

+6
source share
2 answers

If you only have x86 and armeabi-v7a libraries, your application should be automatically installed in 32-bit mode.

Are you sure you do not have another library that will contain .so files inside your APK folder lib/arm64-v8a ? In this case, only the libs inside this folder will be installed (without yours).

Edit: to enable only x86 and armeabi-v7a libs you can use abiFilters:

 android { .... defaultConfig { .... ndk { abiFilters "armeabi-v7a", "x86" } } } 
+15
source

32-bit libraries cannot be loaded from 64-bit code. You need to compile a 64-bit version of your library or make your Java application 32-bit.

-3
source

Source: https://habr.com/ru/post/989545/


All Articles