29

I downloaded an icon from google Material.io. while trying to build my project after integrating it, I ran into the error that says: Can't process attribute android:fillColor="@android:color/white"

Here is a screenshot: Can't process attribute android:fillColor="@android:color/white"

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
Ojay
  • 663
  • 2
  • 9
  • 21

5 Answers5

68

In the app build.gradle add the following line within the android section:

defaultConfig{
    vectorDrawables.useSupportLibrary = true
}

Check This For Further Detail :Vector drawables overview

Birju Vachhani
  • 6,072
  • 4
  • 21
  • 43
Bhavesh Moradiya
  • 1,323
  • 14
  • 18
41

Open the drawable you downloaded and replace android:fillColor="@android:color/white" with android:fillColor="#ffffff". In vector drawables the fillColor attribute must be set explicitly and not reference other resources

  • Nice... that was helpful, so what do I do about the Android tint attribute indicating error – Ojay Jul 13 '18 at 13:12
  • 5
    This is the wrong answer. [Here](https://stackoverflow.com/a/53846109/3290339) is the solution. – Onik Jun 01 '20 at 14:01
6

There are two ways to fix this.

One quick option is to go to the problematic XML file and change android:fillColor="@android:color/white" to android:fillColor="#FFFFFF". The error would disappear immediately. However, this problem would still recur if you have any other file with a similar line in the future.

Here's permanent solution:

Go to your build.gradle file and add this:

defaultConfig{
    vectorDrawables.useSupportLibrary = true
}

Sync and the error would disappear immediately.

Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
0

You should use AppCompatTheme to access to ?attr/colorControlNormal

wSakly
  • 387
  • 1
  • 10
0

AS 3.3.2 / gradle-4.10.1

I had the same compiler problem:

Error: java.lang.RuntimeException: java.lang.RuntimeException: Error while processing .../main/res/drawable/ic_white_set.xml : Can't process attribute android:fillColor="@color/selector_tab_color": references to other resources are not supported by build-time PNG generation.

I opened the incriminated file and got the following Lint warning:

Resource references will not work correctly in images generated for this vector icon for API < 21; check generated icon to make sure it looks acceptable. Inspection info:Vector icons require API 21 or API 24 depending on used features, but when minSdkVersion is less than 21 or 24 and Android Gradle plugin 1.4 or higher is used, a vector drawable placed in the drawable folder is automatically moved to drawable-anydpi-v21 or drawable-anydpi-v24 and bitmap images are generated for different screen resolutions for backwards compatibility. However, there are some limitations to this raster image generation, and this lint check flags elements and attributes that are not fully supported. You should manually check whether the generated output is acceptable for those older devices. Issue id: VectorRaster

Then I checked my build.gradle files and, sure enough, they all had minSdkVersion to 16.

So, as an alternative to the @Bhavesh Moradiya solution, I set minSdkVersionto 21 and the problem was solved.

The drawback is that you lose support for devices with SDK < 16 though.

PJ_Finnegan
  • 1,981
  • 1
  • 20
  • 17