I'm getting a crash in the Android Studio emulator and in the Google PLay Pre-Launch checks for just oe device.
The resource listed defintely exists in my source - it is in the drawable
folder rather than any specific dpi folder - and it is found on all other devices I've tried my app on, that is emulator devices, Pre-launch Test devices and a couple of physocal devices.
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_amalfi_pro_link.xml from drawable resource ID #0x7f080071
The main differences that I can see with teh device that is failing is that it is lower resolution - hence me checking that the vector drawables are in teh drawable folder, not a specific dpi folder.
The crashing device is also API 19 whereas the working devices are later versions. (I get a similar crash for a different resource that I haven;t fully investogated yet for API 21 in the Pre Launch teses).
Note that I have legacy support for vector drawables enabled in my build.gradle (app)
with:
vectorDrawables {
useSupportLibrary true
}
I have tried a clean build - no change.
I have tried invalidating caches and rebuilding - no change.
I have tried changing the drawable for something else, changing back and rebuilding - no change.
I did have the same crash with a different drawable on teh same emulator test device and replacing that drawable with a differen drawable avoided that first crash and moved me oon to this next drawable causing the crash, so it does seem to e related to specific drawables - BUT the drawable IS there and does work on other devices.
This is so frustrating, I just don't know where else to look for the issue.
Update:
Following the content below requiring clarification regarding whether the vector drawable in question is used in any other activity I tested some more.
I have checked the drawable XML and it is identical (other than the path details) to other vector drawables I am using on this project that do not cause the crash.
Starting with release 1.1.0-alpha01
of the AndroidX AppCompat library, there are "compat" attributes for compound vector drawables:
app:drawableTopCompat
app:drawableLeftCompat
app:drawableStartCompat
You must be using AppCompatTextView
to leverage these attributes. If your layout is inflated by a LayoutInflater
built from an AppCompat theme, this will happen automatically when you use <TextView>
tags. If not, you will have to explicitly specify them as <androidx.appcompat.widget.AppCompatTextView>
tags.