Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resources$NotFoundException exception for drawable - but it does exist?

Tags:

android

I'm starting to see an odd set of stack traces from the marketplace crash reports interface. I'm being told a drawable resource does not exist. The xml in question:

<ImageView
  android:layout_width="13dip"
  android:layout_height="12dip"
  android:src="@drawable/foo"
  />

causing:

java.lang.RuntimeException: 
    Unable to start activity ComponentInfo{com.me.app/com.me.app.MyActivity}: 
    android.view.InflateException: Binary XML file line #51: 
    Error inflating class <unknown>
...
Caused by: android.content.res.Resources$NotFoundException: 
  File res/drawable-hdpi/foo.png from drawable resource ID #0x7f020166
  at android.content.res.Resources.loadDrawable(Resources.java:1732)
  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  at android.widget.ImageView.<init>(ImageView.java:118)
  at android.widget.ImageView.<init>(ImageView.java:108)
Caused by: java.io.FileNotFoundException: 
  res/drawable-hdpi/foo.png
  at android.content.res.AssetManager.openNonAssetNative(Native Method)
  at android.content.res.AssetManager.openNonAsset(AssetManager.java:417)
  at android.content.res.Resources.loadDrawable(Resources.java:1724)

Now "foo.png" exists in both my "drawable" and "drawable-hdpi" folders. I haven't touched either of these drawables in ages - not sure why this error started popping up? Happening on a range of devices, Droids, Nexus Ones, etc.

Thanks

like image 794
user291701 Avatar asked Oct 05 '11 18:10

user291701


1 Answers

Try by placing foo.png in other drawable folder i.e. mdpi, xhdpi and xxhdpi also. May be it can help.

like image 144
user3647834 Avatar answered Oct 10 '22 08:10

user3647834