简体   繁体   中英

android untrue resource not found exception

I am not a new developer to 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? 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.

  2. There was some problem in downloading or installing APK from market (file can be corrupted).

  3. User get APK with corrupted file from other source (for example via bluetooth from other user)

  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.

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.

Could it be that the application was pushed to SD Card and something happens to the drawable while on SD. I saw similar issues with layouts rather drawable and it was because the application was pushed to SD.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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