3

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?

Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
  • Try to configure your builds as seen in [this question](https://stackoverflow.com/questions/39419596/resourcesnotfoundexception-file-res-drawable-abc-ic-ab-back-material-xml). – Bingostew Sep 02 '20 at 23:19
  • @Bingostew Can you be more specific? I've got the `vectorDrawables.useSupportLibrary = true` in my build. I forgot to mention in the post (I'll update it) that this is a Firebase Crashlytics report from a user and that I can't get it to crash. It works for me every time. – Kenny Wyland Sep 02 '20 at 23:55
  • Does this happen with any other users? What version is this user's API? – Bingostew Sep 03 '20 at 00:13
  • @Bingostew So far only two reports from the same user, API 27 (Android 8.1.0). – Kenny Wyland Sep 03 '20 at 18:19
  • From searching around, some said that this could occur if the user did not directly download your app from the APK file (for example, if they downloaded from an app bundle). If you know another user with the same API and theirs work fine, then it's on the user. If not, we can investigate further. – Bingostew Sep 03 '20 at 19:23
  • @Bingostew We had this issue crop up 3 more times. This seems to be happening in an incredibly weird situation and my ONLY guess about how they could even possibly get into a state where this stacktrace crashes while also being in the state that our Firebase Logging says they are in... is if they tap 3 times in quick succession to logout of the app, and the 1st confirms logout, the 2nd taps the thing that launches the Activity that is crashing, and then the logout finishes and the 3rd taps a button on our start screen to sign up for a new account. It's all very weird. – Kenny Wyland Sep 16 '20 at 18:53
  • @Bingostew The one thing we did notice is that all 4 instances of the crash seem to be on a Nexus 5X running Android 8.1.0. That doesn't seem like a coincidence. – Kenny Wyland Sep 16 '20 at 18:54
  • @KennyWyland I too had multiple, similar crashes in Crashlytics on Nexus 5x running 8.1.0. Could this be some automated test device that firebase / google uses to test the app? Did you find anything on this? – Mayur More Dec 07 '21 at 09:21
  • @MayurMore No, unfortunately. I never figured out what was causing this and I still occasionally get more reports like this. – Kenny Wyland Dec 14 '21 at 17:29

0 Answers0