Caused by android.view.InflateException Binary XML file line #101: Caused by android.content.res.Resources$NotFoundException

Viewed 1065

Got this error from Crashlytics, affecting a few devices:

Caused by android.view.InflateException Binary XML file line #101: Binary XML file line #101: Error inflating class

Caused by android.content.res.Resources$NotFoundException Drawable (missing name) with resource ID #0x7f06008a

The interesting thing is that this has only come about since I released the app in the new Android App Bundle. This didn't happen when releasing the .apk. In fact to resolve it I reverted back to release it as .apk. But I want to have the benefits of a release with the new Android App Bundle. I know it's something to do with the Drawable folders. Here's line 101 in the xml file:

<ImageView
    android:id="@+id/learn_chords_help_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingLeft="0dp"
    android:paddingTop="20dp"
    android:src="@drawable/help"
    android:contentDescription="Learn Chords Help"
    android:layout_toRightOf="@id/learn_chords_button"
    android:layout_above="@id/creditText"
    />

Here's all my drawable folders with/without help.png:

drawable -> help.png
drawable-hdpi -> help.png
drawable-nodpi -> No Help image
drawable-xhdpi -> No Help image
drawable-xxhdpi -> help.png

Here's some devices that the error occurred on (according to Crashlytics, I couldn't replicate it with the few test handsets we have): Galaxy J7(2016) 7.0, Optimus L40 4.42, m3 Note 5.1, Galaxy s4 4.4.2)

Is this a bug in the Google Play's new App Bundle format, or do developers need to have all the drawable folders with assets in each of them?

2 Answers

Since you don't have help.png in xhdpi folder, that's why you have that error, because xhdpi is associated for 720 X 1280px density (ex: Galaxy J7).

You could put only the xxhdpi picture to no-dpi folder, or put that picture in all the folders.

In your build.gradle file of App Level

this may be present

bundle {
    density {
        enableSplit true
    }
    abi {
        enableSplit true
    }
    language {
        enableSplit false
    }
}

You can remove the density tag, or remove the whole bundle tag because this comes in the Beta Release of the AAB, now google will take care of all the resources to split.

Related