Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updated Android Studio to 3.0 and getting this issue

Error:Execution failed for task ':App:mergeDebugResources'.     > There were multiple failures while executing work items        > A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction           > Error while processing /media/nikhilesh/App/src/main/res/drawable/ic_add_black_24dp.xml : Can't process attribute android:fillColor="@color/green": references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details. 

How can we solve this?

like image 747
Nikhilesh Patve Avatar asked Oct 26 '17 06:10

Nikhilesh Patve


People also ask

Why is Android Studio not working?

If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin.

How do I revert to an older version of Android Studio?

Currently there is no direct way with which a downgrade can be done. I managed to do the downgrade by downloading Android Studio 3.0. 1 from here and then running the installer. It will prompt whether to uninstall previous version, and when you allow and proceed, it will remove 3.1 and install 3.0.

Which android version is best for Android Studio?

Android Studio 3.2 is the best way for app developers to cut into the latest Android 9 Pie release and build the new Android App bundle.


2 Answers

You can add the following line inside your default config of your app build.gradle:

defaultConfig{    vectorDrawables.useSupportLibrary = true } 

Edit: you also need to add this dependency if you didn't already

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

Update:

Since Gradle 3.4 the compile configuration is deprecated and should be replaced by implementation:

dependencies {     implementation 'com.android.support:appcompat-v7:27.1.1' } 
like image 196
rotemitz Avatar answered Sep 23 '22 01:09

rotemitz


The problem is because the new gradle cannot refer to color library, which you use to get the @color/green value.

The solution is same as rotemitz said Just add this line to your defaultConfig of build.gradle (Module : app)

vectorDrawables.useSupportLibrary = true 

AND to dependencies of the same build.gradle

compile 'com.android.support:appcompat-v7:23.1.0' 

Note : You may change the appcompat version, refer to your compile SDK version

like image 22
Andrew Avatar answered Sep 25 '22 01:09

Andrew