It took 3 separate things for me to get this to work using support library 23.4.0:
-
Add this to
build.gradledefaultConfig { vectorDrawables.useSupportLibrary = true } -
Add the following to onCreate of your
ApplicationclassAppCompatDelegate.setCompatVectorFromResourcesEnabled(true);(From the reference of this link – “https://stackoverflow.com/a/45582033/10752962”)
In API less then 21,use this line before
setContentView(); -
For all XML views in which you are setting a vector drawable replace
android:srcwith
app:srcCompatand in the code replace this:
imageView.setImageResource(...);with
imageView.setImageDrawable(...);