I have a library loaded like this:
static {
System.loadLibrary("myLibrary");
}
This works fine on most devices. On one device, however, it causes a crash with this stacktrace:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/vendor/overlay/myBuild.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "myLibrary.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at com.sony.foo.bar.<clinit>(myClass.java:20)
The accepted answer here prompted me to try adding a copy of myLibrary to a new armeabi-v7
folder, where the original library was in a folder named armeabi
. This fixed the crash.
I am trying to make sense out of this. Does this mean the crashing phone has a different CPU? A CPU-identifier app identifies it as having the same type (maker, model) as the others. Even supposing the crashing phone is armeabi-v7
, the most upvoted answer here and the accepted answers here and here make it sound like an armeabi-v7
phone should be able to use the library in the armeabi
folder. Is this not the case?
Lastly, is there some better approach to this fix so that I don't have two identical copies of the same library in the apk?
This turned out to be caused by having another version of the app installed on the phone in /system/priv-app. Removing that one prevented the crash.