Binary XML file line #1: invalid drawable tag vector
Documentation about Vector Graphics says:
Android 4.4 (API level 20) and lower doesn't support vector drawables.
With Support Library you have backward-compatibility using the attribute app:srcCompat
, but it is not backported for android:drawableRight
.
The solution is to keep using .PNG files for those cases or try to set it by code.
implementation 'androidx.appcompat:appcompat:{current_version}'
If the issue is caused by a drawableLeft
or drawableRight
then replace TextView
with androidx.appcompat.widget.AppCompatTextView
or EditText
with androidx.appcompat.widget.AppCompatEditText
.
Then, use one of:
app:drawableLeftCompatapp:drawableStartCompatapp:drawableEndCompatapp:drawableRightCompat
To create vector drawable use:
vector = VectorDrawableCompat.create(context.getResources(), R.drawable.res, null);
Or add AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
to Application onCreate()
method
Note: this solution doesn't work for android:drawableLetf or android:drawableRight but allow to use app:srcCompat