应用程序奇怪的FileNotFoundException异常异常

应用程序奇怪的FileNotFoundException异常异常

本文介绍了从野生Android应用程序奇怪的FileNotFoundException异常异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Android应用程序现在是在生产,和我偶尔看到异常(通过空气制动报道)用这样的东西:

I'm working on an Android app which is now in production, and am occasionally seeing exceptions (reported via airbrake) with stuff like this:

[1.0.4] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.android/com.mycompany.android.activities.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
... cut lots of stuff ...
### CAUSED BY ###: java.io.FileNotFoundException: res/drawable-hdpi/tab_active.9.png:
AssetManager.java:-2:in `android.content.res.AssetManager.openNonAssetNative'
AssetManager.java:406:in `android.content.res.AssetManager.openNonAsset'
Resources.java:1706:in `android.content.res.Resources.loadDrawable'
... cut lots more stuff ...

在测试中,这种观点确实是制订多个华电国际的设备,使资源被罚款那里。建立最终​​的APK之前,我做了全面清理/重建,当然发送的APK了内部测试。我得到1-2的例外是这样每版,而不是10,000事实将表明这个资源是绝对正确的包装对于大多数用户。

In testing, this view definitely worked on multiple HDPI devices, so that resource was fine there. Before building the final APK, I did a full clean/rebuild, and of course sent the APK out for internal testing. The fact that I get 1-2 exceptions like this per version instead of 10,000 would indicate that this resource is definitely packaged correctly for most users.

我完全难倒并不能确定为什么它不会对某些手机加载。有没有人见过这样的事情在他们的应用程序?

I'm completely stumped and unsure why it wouldn't load on certain phones. Has anyone seen something like this in their apps?

推荐答案

我从来没有追查这个问题的确切原因,但根据我的经验,发展有问题的软件,我相信它被击中的内存限制造成的的活性。后您的活动耗尽内存,似乎种种奇怪的错误可能发生,包括像这样的事情。

I never did track down the exact cause of this problem, but based on my experience developing the app in question I believe it was caused by hitting the memory limit for the activity. After your activity runs out of memory, it seems that all sorts of strange errors can happen, including stuff like this.

当我做了其他改善应用程序的内存管理(特别是使用 SoftReference 使用位图),这些类型的例外开始出现频率较低。

When I made other improvements to the app's memory management (particularly by using SoftReference with Bitmaps), these type of exceptions starting appearing less frequently.

这篇关于从野生Android应用程序奇怪的FileNotFoundException异常异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:42