将Android Studio更新到3.0并解决了这个问题

将Android Studio更新到3.0并解决了这个问题

问题描述:

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?

您可以在应用程序build.gradle的默认配置中添加以下行:

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

defaultConfig{
   vectorDrawables.useSupportLibrary = true
}

如果还没有,则还需要添加此依赖项

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

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

更新:

从Gradle 3.4开始,compile配置为已弃用,应该用implementation代替:

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'
}