I have ImageView with app:srcCompat="@drawable/my_app_img"
I get:
android.content.res.Resources$NotFoundException File res/drawable/$my_app_img__0.xml from color state list resource ID #0x7f07000a
on Android 6 and do not get it on 8 and above.
Here is the my_app_img.xml:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
xmlns:tools="http://schemas.android.com/tools"
android:width="73dp"
android:height="103dp"
android:viewportWidth="73"
android:viewportHeight="103">
<path
android:fillAlpha="0"
android:fillColor="#000000"
android:pathData="M0,0l72.299,0l0,103l-72.299,0z" />
<path android:pathData="M70.379,96.761L40.602,56.464L25.724,77.276C22.268,82.111 22.324,88.62 25.864,93.394L28.417,96.839C31.291,100.714 35.832,103 40.659,103H67.227C70.442,103 72.288,99.345 70.379,96.761Z">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#FF094EC2"
android:endX="31.7222"
android:endY="68.3161"
android:startColor="#FF005AF4"
android:startX="57.4428"
android:startY="104.487"
android:type="linear"
tools:targetApi="n" />
</aapt:attr>
</path>
<path android:pathData="M68.592,0H38.75C36.254,0 33.907,1.188 32.431,3.199L2.949,43.369C-0.919,48.64 -0.988,55.79 2.778,61.134L19.001,84.156C19.001,80.833 20.044,77.594 21.984,74.895L71.598,5.853C73.355,3.407 71.606,0 68.592,0Z">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#FF29EEFD"
android:endX="32.6558"
android:endY="31.6712"
android:startColor="#FF2EB3ED"
android:startX="6.53102"
android:startY="64.8591"
android:type="linear" />
</aapt:attr>
</path>
</vector>
Also I use:
vectorDrawables.useSupportLibrary = true
I am having the same problem. The reason I found it seems to be the issue of android grade plugin version.
Your vector image only supports API 24 or higher. Under 3.2.x or below, I changed from device to PNG file under API 24. However, from 3.3.x there is a crash in that part.
Are you using 3.3.x?
If so, you can use Are you using 3.2.x or below Or it works well with AndroidX.
Alternatively, you can use the Vector only in API version 24 or higher, or use a PNG file in lower versions.
I have not found a better way yet.
I hope this helps.