简体   繁体   English

android untrue资源未找到异常

[英]android untrue resource not found exception

I am not a new developer to android. 我不是android的新开发者。 I have an application on the market. 我在市场上有一个应用程序。 However, sometimes I get reported strange exceptions to have occured: 但是,有时我会报告发生奇怪的异常:

java.io.FileNotFoundException: res/drawable-mdpi/background.png

 android.content.res.Resources$NotFoundException: File res/drawable-mdpi/background.png from drawable resource ID #0x7f02001f

This is by all means untrue because otherwise I wouldn;t have compiled or run the program myself. 这绝对是不真实的,否则我不会自己编译或运行程序。 Also I am sure the resources are there. 我也相信资源在那里。 This is just one of the exception I have been reported. 这只是我被报道的例外之一。 There are same exceptions for other resources mainly layouts. 其他资源主要是布局也有相同的例外。

So my question is how would this happen? 所以我的问题是这会怎么样? Is it because the android system has failed installing correctly my app? 是因为Android系统无法正确安装我的应用程序? I almost sure this must be the case because I have many users who use it without problem. 我几乎可以肯定这是必须的,因为我有很多用户没有问题地使用它。

Please help regarding this. 请帮忙解决这个问题。

There can be several possible reasons: 可能有以下几种原因:

  1. Moving application to SD card. 将应用程序移动到SD卡。

  2. There was some problem in downloading or installing APK from market (file can be corrupted). 从市场下载或安装APK存在一些问题(文件可能已损坏)。

  3. User get APK with corrupted file from other source (for example via bluetooth from other user) 用户从其他来源获取带有损坏文件的APK(例如来自其他用户的蓝牙)

  4. Some system bug (from software, to brocken hardware) 一些系统错误(从软件到布鲁克硬件)

Any way You can't do anything with this problem. 任何方式你都无法解决这个问题。

Maybe you have included certain codes that reference content from Android SDK. 也许您已经包含了某些引用Android SDK内容的代码。

In my case, I faced similar issue and when I removed the line 在我的情况下,我遇到了类似的问题,当我删除线

android:background="?android:attr/actionBarItemBackground"

from my xml, everything works fine again. 从我的xml,一切正常。

Could it be that the application was pushed to SD Card and something happens to the drawable while on SD. 可能是应用程序被推送到SD卡,并且在SD上有些事情发生在drawable上。 I saw similar issues with layouts rather drawable and it was because the application was pushed to SD. 我看到类似布局的问题相当抽象,这是因为应用程序被推送到SD。

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

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