Crashlytics is telling me that my app is crashing when it tries to inflate a particular layout because it can't find the image_uparrow.xml image in the res/drawable-nodpi-v4/.
But I don't have a res/drawable-nodpi-v4/ directory. The only version of image_uparrow.xml in my entire project is in res/drawable-nodpi/ without the -v4.
That image_uparrow.xml is a selector that (oddly) has only one entry in it (must have been an old refactoring artifact or something).
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/uparrow" /> <!-- default -->
</selector>
And @drawable/uparrow has two possibilities:
res/drawable-mdpi/uparrow.pngres/drawable-hdpi/uparrow.png
So, beyond the weirdness of having only one item in the selector, why on earth would the system try to open a file in res/drawable-nodpi-v4 when I don't even have that directory in my project at all?
Here's the crash stacktrace:
Fatal Exception: android.view.InflateException: Binary XML file line #10 in com.inadaydevelopment.cashcalculator:layout/deletereorder_cell: Binary XML file line #10 in com.inadaydevelopment.cashcalculator:layout/deletereorder_cell: Error inflating class ImageButton
Caused by android.view.InflateException: Binary XML file line #10 in com.inadaydevelopment.cashcalculator:layout/deletereorder_cell: Error inflating class ImageButton
Caused by android.content.res.Resources$NotFoundException: Drawable com.inadaydevelopment.cashcalculator:drawable/image_uparrow with resource ID #0x7f0800d0
Caused by android.content.res.Resources$NotFoundException: File res/drawable-nodpi-v4/image_uparrow.xml from drawable resource ID #0x7f0800d0
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:874)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:668)
at android.content.res.Resources.loadDrawable(Resources.java:993)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1007)
at android.content.res.TypedArray.getDrawable(TypedArray.java:982)
at android.widget.ImageView.<init>(ImageView.java:204)
at android.widget.ImageButton.<init>(ImageButton.java:86)
at android.widget.ImageButton.<init>(ImageButton.java:82)
at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:78)
at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73)
at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:253)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:168)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1678)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1729)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1065)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1001)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
at com.inadaydevelopment.cashcalculator.CashFlowActivity.addCashFlowRow(CashFlowActivity.java:349)
at com.inadaydevelopment.cashcalculator.CashFlowActivity.addAllCashFlowRows(CashFlowActivity.java:212)
at com.inadaydevelopment.cashcalculator.CashFlowActivity.touchedDeleteReorderButton(CashFlowActivity.java:201)
at com.inadaydevelopment.cashcalculator.CashFlowActivity.onOptionsItemSelected(CashFlowActivity.java:126)
at android.app.Activity.onMenuItemSelected(Activity.java:4343)
at ...
The part of the layout xml that is having the problem is:
<ImageButton
android:id="@+id/upButton"
style="@style/Cashflow.ReorderButton.Up"
android:layout_alignParentStart="true"
android:contentDescription="@string/move_row_up" />
Here's the referenced style, which is where the image is defined:
<style name="Cashflow.ReorderButton.Up">
<item name="android:src">@drawable/image_uparrow</item>
</style>