构建时 PNG 生成不支持对其他资源的引用 [英] References to other resources are not supported by build-time PNG generation

查看:31
本文介绍了构建时 PNG 生成不支持对其他资源的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AndroidStudio 3.0/Android Gradle 插件 3.0

AndroidStudio 3.0 / Android Gradle plugin 3.0

<vector>
  <path android:fillColor="@color/image_button_disabled"/>
</vector>

我收到此错误:

构建时 PNG 生成不支持对其他资源的引用

references to other resources are not supported by build-time PNG generation

是否有可能解决它或者它是一个已弃用的解决方案?

Will it be possible to resolve it or is it a deprecated solution?

推荐答案

支持 API SDK <24 将以下行添加到您的应用程序 build.gradleandroid 块内:

To support API SDK < 24 add the following line to your app build.gradle inside the android block:

defaultConfig {
   vectorDrawables.useSupportLibrary = true
}

如果您的 minSdkVersion 为 24 或更高,那么您的问题将自行解决,因为 VectorDrawables 从此 API 开始得到全面支持.

If your minSdkVersion is 24 or higher, then your issue will be resolved on its own, because VectorDrawables have full support starting with this API.

请参阅 Android 开发人员:Vector Drawables 向后兼容解决方案了解详情.

这篇关于构建时 PNG 生成不支持对其他资源的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆