I was checking my bug reports and from time to time we get this bug report from our app. I can't pint point what is the actual problem. This resource does exist, most of devices work fine but some specific devices like LG-E510 or U8815 just cant load this resource.
Any ideas?
android.content.res.Resources$NotFoundException: File res/drawable-xhdpi/action_bar_search_icon.png from drawable resource ID #0x7f02007f
at android.content.res.Resources.loadDrawable(Resources.java:1714)
at android.content.res.Resources.getDrawable(Resources.java:581)
at com.actionbarsherlock.internal.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:384)
at com.actionbarsherlock.internal.view.menu.ActionMenuItemView.initialize(ActionMenuItemView.java:128)
at com.actionbarsherlock.internal.view.menu.ActionMenuPresenter.bindItemView(ActionMenuPresenter.java:192)
at com.actionbarsherlock.internal.view.menu.BaseMenuPresenter.getItemView(BaseMenuPresenter.java:176)
at com.actionbarsherlock.internal.view.menu.ActionMenuPresenter.getItemView(ActionMenuPresenter.java:178)
As you have stated, if the phone / tab accesses the xhdpi directory then we expect it to scale the image appropriately to fit the screen. Therefore we expect that if the resource exists in ANY ONE of the directories then we will never see a ResourceNotFound exception. HOWEVER:
xhdpi was only introduced in Android SDK 8, so if you target SDK 7 and earlier you may run into problems:
Only use XHDPI drawables in Android app?
Another reason why Android may not be able to access the xhdpi directory is if the device is running in screen compatability mode:
Android - Extra large images placed in res/drawable-xhdpi aren't showing on tablet emulator, why?
Another possible reason is if your drawable is very small and one of its dimensions is rounded to zero as a result of scaling:
Android resource not found because of width and height
Finally, it is possible that some OEM versions of Android may implement this in a non-standard way (e.g "enhancing performance" by not searching the xhdpi directory if their device is hdpi):
Android Drawable hdpi xhdpi mdpi ldpi concept
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With