Can't process attribute android:

2019-06-22  本文已影响0人  Everglow_111

项目运行的时候报错

Can't process attribute android:fillColor="@android:color/white": references to other resources are not supported by build-time PNG generation.
File was preprocessed as vector drawable support was added in Android 5.0 (API level 21)
See http://developer.android.com/tools/help/vector-asset-studio.html for details.

解决方案

    使用Gradle Plugin 2.0以上:
android {

    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}
使用Gradle Plugin 2.0以下,Gradle Plugin 1.5以上:
android {
  defaultConfig {
    // Stops the Gradle plugin’s automatic rasterization of vectors
    generatedDensities = []
  }
  // Flag to tell aapt to keep the attribute ids around
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

你需要在项目的build.gradle脚本中,增加对Vector兼容性的支持

转自
https://blog.csdn.net/zhouxianling233/article/details/78359338

上一篇 下一篇

猜你喜欢

热点阅读