Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inexplicable UnsatisfiedLinkError on native library load

First and foremost, my application generally works. I have numerous clients on all four 32-bit CPU/ABIs, and they have no trouble running the app. The native library is built for all four architectures. The library is there, the methods are all in place and named right. And yet, I'm getting exception reports ever once in a while that a native library can't be loaded:

java.lang.UnsatisfiedLinkError: Couldn't load foo from loader
dalvik.system.PathClassLoader [DexPathList[[zip file "/data/app/com.myapp-1.apk"],
nativeLibraryDirectories=[/data/app-lib/com.myapp-1, /vendor/lib, /system/lib]]]:
findLibrary returned null

I can't reproduce this, neither on the emulator nor in several devices that I've got access to. I've got reports with this exception from the following devices:

Sony Xperia LT29i (Android 4.3)
Sony Xperia C5303 (Android 4.3)
LG Optimus E405 (Android 2.3.6)

And it's very specific. I have 27 reports so far, but only those three devices. All those are armeabi-v7a devices, not sure if it matters.

Any ideas, please?

EDIT: got some logcat from an Optimus:

I/ActivityManager(23495): process name to start: com.myapp
I/ActivityManager(23495): Start proc com.myapp for activity com.myapp/.Main: pid=5755 uid=10078 gids={3003, 1015, 1007}

That's it. Nothing below that would indicate the error.

like image 614
Seva Alekseyev Avatar asked Oct 20 '22 13:10

Seva Alekseyev


2 Answers

A widespread problem affecting app updates was fixed in 4.3, but it appears the problem has not entirely gone away. Recent updates to the bug call out Xperia devices in particular. Uninstall + reinstall by the end user should work around the problem.

like image 155
fadden Avatar answered Oct 23 '22 04:10

fadden


Uninstall and reinstall works, but you can lose users, unfortunatly. To solve this issue in my project im ussing solution from chromium, its not perfect but looks like it works:

try {
        System.loadLibrary("YourLib");
    } catch (UnsatisfiedLinkError e) {

        System.load("YourLibPath");
    }
like image 30
Alexander Avatar answered Oct 23 '22 03:10

Alexander