I\'m getting crash reports from android marketplace:
android.content.res.Resources$NotFoundException: Resource ID #0x....
I get about 17 of
This could also happen if the resource you are referring to (lets call it ResA) is in-turn referring to a resource which is missing (lets call it ResB). Android will raise the ResourceNotFoundException for ResA even though whats really missing is ResB. Such is life!
In my case, ResB was defined in the values-swxxxdp but not in values. Hence I was getting this exception on phones but not on tablets.
Heh, no idea, I'm actually working on a similar issue, but it could be it. It's worthwhile mentioning that while the device can upscale resources and layouts, it cannot downscale them. So if you have minimum values, set them in the AndroidManifest.xml. Try adding layout-ldpi and layout-small first.
A useful technique for logging which layout got loaded is to attach an android:tag
to every root container of your layout XML file, and in onCreate()
after setting setContentView(R.id.layout)
just print the value of the tag. It will tell you which got loaded - you still have to plug the hole by adding all possible combinations, if just for debug purposes.
also, rename your drawables to drawables-nodpi
folder to ensure no drawables are missing. this turns off internal scaling, makes APKs smaller and doesn't "pick" from any other drawable folder.
once you figure out whether it's the layout or drawable, additional metrics will help you find the root cause. for now, check the layouts first with "always use" drawables.
on monday when i get back to the office I'll post you the metrics code used to measure data captured in this thread - Which part of Android is in charge of picking a correct resource profile?
You have included certain codes that reference content from Android SDK.
For example, I faced a similar issue once and when I removed the line
android:background="?android:attr/actionBarItemBackground"
from my xml, everything works fine again.
Is the crash reports coming from version <=1.6, and you have certain resources only in qualified folders, i.e. "drawable-mdpi"
instead of just "drawable"
? If so then read about "Known issues" at the bottom of this page.
This have occurred several times especially on phones with low density. I also noticed that it mostly happens with 9-patch images.
My solution was to include 9-patch images in as much density resource folders as I could (mdpi, ldpi, hdpi, xdpi).