Resources do exist, but Resources$NotFoundException causing InflateException

681 Views Asked by At

This is about a Firebase Crashlytics report from a user and I can't get it to crash. It works for me every time.

InflateException: Binary XML file line #19: Binary XML file line #19: 
Error inflating class androidx.appcompat.widget.AppCompatImageButton
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)

Caused by: Resources$NotFoundException: Drawable com.inadaydevelopment.herdboss:drawable/button_close_24dp 
with resource ID #0x7f08006d

Caused by Resources$NotFoundException: File res/drawable/button_close_24dp.xml 
from drawable resource ID #0x7f08006d

Caused by Resources$NotFoundException: Drawable (missing name) 
with resource ID #0x7f08006e

Caused by Resources$NotFoundException: Unable to find resource ID #0x7f08006e
       at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:253)
       at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:760)
       at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:630)
       at android.content.res.Resources.loadDrawable(Resources.java:886)
       at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:953)
       at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
       at android.content.res.XResources$XTypedArray.getDrawable(XResources.java:1363)
       at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:177)
       at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:122)

I believe resource ID #0x7f08006d is a selector defined in res/drawable/button_close_24dp.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true" android:drawable="@drawable/button_close_grey_24dp" />
    <item android:drawable="@drawable/button_close_white_24dp" />
</selector>

It references @drawable/button_close_grey_24dp and @drawable/button_close_white_24dp one of which must be resource ID #0x7f08006e which is the resource at the root of the exception.

Each of those resources have two versions, a png in res/drawable and an xml vector drawable in res/drawable-nodpi.

screenshot of file listing showing the multiple versions of the drawables

So, as far as I can tell all of the resources are there and appropriately located so that they can be found by new or old devices.

What am I missing?

0

There are 0 best solutions below