Home » Android » android – AppCompat 23.3 Support Vectors no longer work?

android – AppCompat 23.3 Support Vectors no longer work?

Posted by: admin April 23, 2020 Leave a comment


I was using the support vector drawables added in Support Library 23.2 along with AppCompat. I was using vector drawables both with app:srcCompat and inside a StateListDrawable so I could use them with android:drawableLeft for my TextView.

Since upgrading to the 23.3.0 version of AppCompat, only the vectors in app:srcCompat are working. Whenever I reference it the other way I get

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.package.name/.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class Button
 Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class Button
 Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #14: invalid drawable tag vector
  at android.graphics.d

What changed that now causes my support vector drawables to fail in some cases?

How to&Answers:

Update: They enable it again in Support Library 23:

For AppCompat users, we’ve added an opt-in API to re-enable support Vector Drawables from resources (the behavior found in 23.2) via AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); – keep in mind that this still can cause issues with memory usage and problems updating Configuration instances, hence why it is disabled by default.

Check this link: 23.4.0 available now


As per the release announcement for Android Support Library 23.3:

For AppCompat users, we’ve decided to remove the functionality which let you use vector drawables from resources on pre-Lollipop devices due to issues found in the implementation in version 23.2.0/23.2.1 [ https://code.google.com/p/android/issues/detail?id=205236, https://code.google.com/p/android/issues/detail?id=204708 ]. Using app:srcCompat and setImageResource() continues to work.

So this is an expected behavior change. You’ll have to use non-vector graphics for any case not handled by srcCompat.

If you’d like to continue to use vectors prior to API 21, you can remove the line

vectorDrawables.useSupportLibrary = true

(or the equivalent if you using the 1.5 Gradle plugin as shown in the 23.2 blog post).

This will cause Android Studio to generate PNGs at compile time for apps with a minSdkVersion less than API 21 while using your vectors on API 21+ devices, allowing you to keep the same code as with 23.2.1 at the cost of additional APK size.


VectorDrawable support for pre-Lollipop was added in Support Library 23.2.0, then partially removed in 23.3.0. In 23.4.0 and above (at least 25.1.0), that removed part is back but behind an optional flag (because it comes with a price).

To sum up: in Support Library 23.4.0 to at least 25.1.0, you can get VectorDrawable to work in some cases.

I have made this diagram to help.

VectorDrawable cheatsheet


To use vectors as compoundDrawables ( ex. for textview ) without using


which leads to documented high memory usage, just inflate the vector using

Drawable drawable = AppCompatResources.getDrawable( getContext(), R.drawable.vector_resID );
if( drawable != null ) drawable.setBounds( 0, 0, iconSize, iconSize );
TextViewCompat.setCompoundDrawablesRelative( textView, null, null, drawable, null);

This is the way the navDrawer works