本文介绍了将 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'
}

这篇关于将 Android Studio 更新至 3.0 并出现此问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 04:54
查看更多