简体   繁体   English

本机库加载时出现无法解释的UnsatisfiedLinkError

[英]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. 我在所有四个32位CPU / ABI上拥有众多客户端,他们在运行应用程序时没有遇到任何问题。 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. 到目前为止,我有27个报告,但只有这三个设备。 All those are armeabi-v7a devices, not sure if it matters. 所有这些都是armeabi-v7a设备,不确定它是否重要。

Any ideas, please? 请问有什么想法吗?

EDIT: got some logcat from an Optimus: 编辑:从Optimus得到一些 logcat:

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. 下面没有任何内容表明错误。

A widespread problem affecting app updates was fixed in 4.3, but it appears the problem has not entirely gone away. 4.3中修复了影响应用更新的普遍问题,但似乎问题并没有完全消失。 Recent updates to the bug call out Xperia devices in particular. 最近对该bug的更新特别调用了Xperia设备。 Uninstall + reinstall by the end user should work around the problem. 最终用户卸载+重新安装应该可以解决问题。

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");
    }

I had put System.loadLibrary("libMyLibrary") which returned null. 我把System.loadLibrary(“libMyLibrary”)返回null。 I changed it to System.loadLibrary("MyLibrary") and it worked. 我将其更改为System.loadLibrary(“MyLibrary”)并且它有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM