问题描述
我有一些问题,我的祖国活动的应用程序。它工作正常,在99%的设备。但有时用户会收到以下错误:
I have some problems with my Native Activity application. It works fine on 99% of devices. But sometimes users get the following error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{nightradio.sunvox/nightradio.sunvox.MyNativeActivity}:
java.lang.IllegalArgumentException: Unable to find native library: sundog
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2070)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4830)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
...
我不明白为什么。该应用程序已经在armeabi,armeabi-V7A和x86文件夹的所有必要的库。它已经过测试,在许多设备上有不同的架构。
I can't understand why. The app have all necessary libraries in the armeabi, armeabi-v7a and x86 folders. And it has been tested on many devices with different architectures.
机器人:拥有code =真正的选项存在
此外,我注意到,这是最这些有问题的设备有瑞芯微CPU(RK3066,RK2928,RK2926)。但不是全部。最近的一次有华为K3V2 CPU和大量的可用内存。另外本机应用程序的活动(不是我)不要在最新的设备也工作。
Also i noticed, that the most of these problematic devices has Rockchip CPU (RK3066, RK2928, RK2926). But not all. The latest one has Huawei K3V2 CPU and a lot of free memory.Another Native Activity apps (not mine) don't work on the latest device too.
推荐答案
您将需要阅读的logcat输出,看看前大跌,其中$ P $发生加载pvented本机库。我使用阿克拉我的应用程序(生成包含logcat的输出崩溃报告),但作为一个快速的解决方案,以获得没有实现一个整体的崩溃报告系统的logcat输出,你可以使用这样的事情在一个测试版本,并让用户运行它:
You will need to read the logcat output to see what happened prior to the crash, which prevented the native library from loading. I use Acra for my apps (generates crash reports containing logcat output), but as a quick solution to get the logcat output without implementing a whole crash reporting system, you could use something like this in a test build, and have the user run it:
try
{
Process process = Runtime.getRuntime().exec( "logcat -d" );
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader( process.getInputStream() ) );
StringBuilder log = new StringBuilder();
String line = "";
while( ( line = bufferedReader.readLine() ) != null ) {
log.append( line );
}
// Output available via log.toString().. do whatever with it
}
catch( IOException e ) {}
如果你看一下来源$ C $下NativeActivty ,这个异常你看到被扔在OnCreate()方法(参见线171),所以如果你重写该方法在派生类中NativeActivity的的,你可以抓住它,抓住的logcat输出那里。然后,你可以将日志保存到一个文件中,有一个用户使用受影响设备运行测试和文件通过电子邮件发送给你,例如。
If you look at the source code for NativeActivty, this exception you are seeing gets thrown in the onCreate() method (see line 171), so if you override that method in a derived class of NativeActivity, you can catch it and grab the logcat output from there. Then you could save the log to a file and have a user with an affected device run the test and email the file to you, for example.
有关覆盖的另一个好处的onCreate(),是不是也让你重现一些什么样的推移幕后,更多的调试日志记录,以帮助你追踪问题。
Another good thing about overriding onCreate(), is it will also allow you to reproduce some of what goes on behind the scenes, with more debug logging to help you track down the problem.
这篇关于"无法找到本机库"在本地活动的应用程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!