Android的NDK的UnsatisfiedLinkError - 一个令人惊讶的原因 [英] Android NDK UnsatisfiedLinkError - a surprising reason

查看:330
本文介绍了Android的NDK的UnsatisfiedLinkError - 一个令人惊讶的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新2013年8月7日: 现在的问题是解决了,但对于错误的原因是挺意外的,所有常见的犯罪嫌疑人对这种错误的开始被淘汰,我也学到新的东西。见我的回答如下。

Update 8/7/2013: The problem is solved now, but the reason for the error was quite unexpected, all the usual suspects for such errors were eliminated on start, and I have learned something new. See my answer below.

我是pretty的绝望这里。有一个机库,从那里我所说的方法,一个Android应用程序。在所有系统上没问题,我测试过,并且该程序是在谷歌播放没有任何问题报告,使用的数以千计的用户。现在,显然是一个新的ROM - Android版4.2.2 - 对于HTC One手机已经出来了。用户声称,这是官方的版本,升级形式的官方渠道。当他们尝试启动我的应用程序,它崩溃,和堆栈跟踪说:

I'm pretty desperate here. Have an Android app with a native library, from where I call a method. No problem on all the systems I tested, and the program was out in Google Play without any trouble reports, used by thousands of users. Now, apparently a new ROM - Android version 4.2.2 - for HTC One phone is out. Users claim that it's the official build, upgraded form the official channel. When they try to start my app, it crashes, and the stack trace says:

java.lang.UnsatisfiedLinkError中:本机方法没有找到......

java.lang.UnsatisfiedLinkError: Native method not found...

和它的,我知道在那里,工作正常刚才在同一设备上时,他们的Andr​​oid 4.1的安装方法名。我测试它的Andr​​oid 4.2.2下在仿真器(不具有此特定设备),并没有任何问题。此外,用户尝试卸载和重新安装具有相同的结果的应用程序。即使把他们的私人版本,没有任何的ProGuard / Dexguard保护于事无补。

and the method name of which I know is there and worked fine a moment ago on the same device when they had Android 4.1 installed. I test it under Android 4.2.2 in emulators (don't have this particular device) and there is no problem. Also, the users tried uninstalling and reinstalling the app with the same result. Even sending them a private build, without any ProGuard/Dexguard protections does not help.

还有什么能引起java.lang.UnsatisfiedLinkError中在Android?或者我应该认为这款HTC ROM简直是越野车???没有任何人对HTC的一个类似的问题了Android 4.2.2?

What else can cause java.lang.UnsatisfiedLinkError on Android? Or should I assume that this HTC ROM is simply buggy??? Did anyone else have similar problems on HTC One with Android 4.2.2?

在下面其他开发人员的意见表明,该系统可能有麻烦找我的本地库。我从完全安装拆卸本地库文件实验上Genymotion 4.2.2模拟器。该错误信息是在这种情况下不同,得到了:

In the comments below another developer suggests that the system could have troubles finding my native library. I experimented on Genymotion 4.2.2 emulator by removing the native library file from the setup completely. The error message is different in this situation, got:

W / System.err的:致:java.lang.UnsatisfiedLinkError中:无法加载从装载机CLD dalvik.system.PathClassLoader[dexPath=/data/app/com.hyperionics.avar-2.apk,libra‌​ryPath=/data/app-lib/com.hyperionics.avar-2]: findLibrary返回null

W/System.err: Caused by: java.lang.UnsatisfiedLinkError: Couldn't load cld from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.hyperionics.avar-2.apk,libra‌​ryPath=/data/app-lib/com.hyperionics.avar-2]: findLibrary returned null

而在我从HTC得到了一个用户与Android 4.2.2堆栈跟踪消息我看到此错误消息:

While in the stack trace messages I got from HTC One users with Android 4.2.2 I see this error message:

致:java.lang.UnsatisfiedLinkError中:本机方法未找到:com.hyperionics.avar.CldWrapper.detectLangNative:(Ljava /朗/字符串;)[Ljava /朗/字符串;

Caused by: java.lang.UnsatisfiedLinkError: Native method not found: com.hyperionics.avar.CldWrapper.detectLangNative:(Ljava/lang/String;)[Ljava/lang‌​/String;

要我看来,系统找到libcld.so文件作为必要的,但没有找到它需要有方法。为什么???我知道的方法是存在的,需要出口,和所有其他设备和系统,同时这些运行Android 4.2.2,发现它。只有HTC的一个与4.2.2失败有...

To me it appears that the system finds the libcld.so file as needed, but does not find the method it needs there. Why??? I know the method is there, exported as needed, and every other device and system, also these running Android 4.2.2, finds it. Only HTC One with 4.2.2 fails there...

入门50代表一个赏金。点,因为我没有的HTC One与我卡住。会接受一个答案,要么指向一个方法来解决这个问题 - 和回答的人将考验我的codemod。要显示它的工作原理 - 或证明,这的确是最近的Andr​​oid 4.2.2 ROM中的HTC One的错误。有问题的应用程序是<一href="https://play.google.com/store/apps/details?id=com.hyperionics.avar">https://play.google.com/store/apps/details?id=com.hyperionics.avar

Started a bounty for 50 rep. points, as I don't have HTC One and am stuck. Will accept an answer that either points a way to solving the problem - and the answering person will test my code mod. to show it works - or proves that this is really a bug in the recent Android 4.2.2 ROM for HTC One. The app in question is https://play.google.com/store/apps/details?id=com.hyperionics.avar

赏金,仍然没有答案的最后一天,不建议......到目前为止,我得到来自欧洲所​​有这样的错误报告,报告的品牌是htc_europe或vodafone_fr。也许错误定位于欧洲(法国+德国)只有...如果还有人在那里与HTC One和Android的更新到4.2.2,我有兴趣,如果在其他国家,或与其他供应商的错误发生。

The last day of the bounty and still no answers, no suggestions... So far, all such error reports I get come from Europe, reported brand is "htc_europe" or "vodafone_fr". Maybe the error is localized to Europe (France + Germany) only... If there is anyone out there with HTC One and Android updated to 4.2.2, I would be interested if the error happens in other countries or with other providers.

格雷格

推荐答案

有在赏金期间没有满意的答案。我订购的设备,将不得不调试什么最有可能的是Android 4.2.2更新的设备ROM的系统错误...

There was no satisfactory answer during the bounty period. I ordered the device and will have to debug what most likely is a system bug in the device ROM for Android 4.2.2 update...

事实证明,有时,更新从谷歌播放的应用程序时,本地库安装不正确。也许安装程序运行的空间,或在其他一些莫名其妙的系统漏洞踢,请参见<一href="http://stackoverflow.com/questions/18111739/why-do-some-android-phones-cause-our-app-to-throw-an-java-lang-unsatisfiedlinker/24296556#24296556">this SO问题和答案。

It turns out that sometimes, when updating an app from Google Play, native libraries are not installed correctly. Maybe the installer runs out of space, or some other strange system bug kicks in. Please see also this SO question and answers.

我的HTC One从谷歌播放订购到了,......解开了谜底!同样的崩溃也发生在从谷歌播放原生Android 4.2.2。问题是我的库名:CLD,产生一个名为libcld.so的共享库。显然,该系统具有相同的名称,在这里我想到的方法都没有present,当然......也许有些插件加载此等libcld.so到进程的内存,和我自己的图书馆是另一个共享库跳过。我改名的本地库,程序立即启动工作。

My HTC One ordered from Google Play arrived, and... mystery solved! The same crash happened also on the original Android 4.2.2 from Google Play. The problem was my library name: cld, which produces a shared library named libcld.so. Apparently the system has another shared library with the same name, where the methods I expect are not present, of course... Probably some "plugin" loaded this other libcld.so into the process memory, and my own library was skipped. I renamed the native library and the program started working at once.

我不知道对不同的Andr​​oid建立的......这样的名称冲突的可能性,没有人也阅读本看到一个警告某处NDK的文档呢?我想我会preFIX从现在起,我和我的公司名称或东西创建所有本地库。

I was not aware of the possibility of such name clashes on different builds of Android... Did anyone reading this see a warning somewhere in NDK docs about it? I guess I'll prefix from now on all native libraries I create with my company name or something.

这篇关于Android的NDK的UnsatisfiedLinkError - 一个令人惊讶的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆