References to other resources are not supported by build-time PNG generation

To support API SDK < 24 add the following line to your app build.gradle inside the android block:

defaultConfig {
   vectorDrawables.useSupportLibrary = true
}

If your minSdkVersion is 24 or higher, then your issue will be resolved on its own, because VectorDrawables have full support starting with this API.

See Android Developers: Vector Drawables Backward Compatibility Solution for details.


you need to use the hex code directly not referring to a resource.

<vector
  <path
    android:fillColor="#FFF"/></vector>

Little bit more context for this error:

  • Android 5.0 (API level 21) was the first version to officially support vector drawables.
  • If you use minSdkVersion lower than 20, there are two solutions for vector drawable
    • Android Studio's Vector Asset Studio generate PNG. Please take a look Android Studio document. But, references to other resources are not supported by build-time PNG generation.
    • Use support library
  • Or, use 21 or above for minSdkVersion

For support library, add a statement to your build.gradle file:

android {
  defaultConfig {
    vectorDrawables.useSupportLibrary = true
  }
}

dependencies {
  compile 'com.android.support:appcompat-v7:23.2.0'
}

Do not use colorReference at fillColor attribute in Vector drawable just use hexa code

use like this

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
<path
    android:fillColor="#1abc9c"
    android:pathData="M9,11L7,11v2h2v-2zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM19,4h-1L18,2h-2v2L8,4L8,2L6,2v2L5,4c-1.11,0 -1.99,0.9 -1.99,2L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.9,-2 -2,-2zM19,20L5,20L5,9h14v11z"/>

instead of this

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
<path
    android:fillColor="@color/colorPrimary"
    android:pathData="M9,11L7,11v2h2v-2zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM19,4h-1L18,2h-2v2L8,4L8,2L6,2v2L5,4c-1.11,0 -1.99,0.9 -1.99,2L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.9,-2 -2,-2zM19,20L5,20L5,9h14v11z"/>