This took me several hours to figure out so I thought its worth
reporting...
Manifest:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
<supports-screens android:smallScreens="true"
android:normalScreens="true" android:largeScreens="true"
android:anyDensity="true" />
Resource strategy:
res/drawable
res/drawable-hdpi-v4
No problems when testing on a Nexus One, but on the HTC Hero got this
exception:
Uncaught handler: thread main exiting due to uncaught exception
...skipping...
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.ImageButton.<init>(ImageButton.java:47)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:499)
... 25 more
Caused by: android.content.res.Resources$NotFoundException: File res/
drawable/title_bar_shadow.9.png from drawable resource ID #0x7f020008
at android.content.res.Resources.loadDrawable(Resources.java:1641)
at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
at android.widget.ImageView.<init>(ImageView.java:113)
at android.widget.ImageButton.<init>(ImageButton.java:51)
... 29 more
Caused by: java.io.FileNotFoundException: res/drawable/
title_bar_shadow.9.png
at android.content.res.AssetManager.openNonAssetNative(Native
Method)
at android.content.res.AssetManager.openNonAsset(AssetManager.java:
392)
at android.content.res.Resources.loadDrawable(Resources.java:1634)
... 32 more
But its nothing to do with title_bar_shadow.9.png.
I guessed there was something corrupted somewhere and even went to the
extent of doing a factory rest on my Hero!
The problem turned out to be my own myicon.png which was present in
res/drawable-hdpi-v4 but not in res/drawable. I'd forgotten to put in
a smaller version in res/drawable.
I could have fixed this problem in seconds if the exception message
was something like:
Caused by: android.content.res.Resources$NotFoundException: File res/
drawable/myicon.png from drawable resource ID #0x7f020008
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en