Nik*_*tve 43 android android-studio
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.
Run Code Online (Sandbox Code Playgroud)
我们怎么解决这个问题?
小智 103
您可以在app build.gradle的默认配置中添加以下行:
defaultConfig{
vectorDrawables.useSupportLibrary = true
}
Run Code Online (Sandbox Code Playgroud)
编辑:如果您还没有,还需要添加此依赖项
dependencies {
compile 'com.android.support:appcompat-v7:27.1.1'
}
Run Code Online (Sandbox Code Playgroud)
更新:
从Gradle 3.4开始,compile配置已弃用,应替换为implementation:
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
}
Run Code Online (Sandbox Code Playgroud)
小智 12
问题是因为新的gradle无法引用用于获取@ color/green值的颜色库.
解决方案与rotemitz相同,只需将此行添加到build.gradle的defaultConfig(模块:app)
vectorDrawables.useSupportLibrary = true
Run Code Online (Sandbox Code Playgroud)
和相同build.gradle的依赖项
compile 'com.android.support:appcompat-v7:23.1.0'
Run Code Online (Sandbox Code Playgroud)
注意:您可以更改appcompat版本,请参阅您的编译SDK版本
您只需要在app build.gradle的默认配置中添加以下行:
defaultConfig{
vectorDrawables.useSupportLibrary = true
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15314 次 |
| 最近记录: |