[英]Android Support Library Build v26.X.X Build Error: Attribute “font” already defined
I'm trying to upgrade from version 25.3.1
to version 26.XX
of the support library, but every time I build the project using the newer version I get this error: 我试图从升级版本
25.3.1
到版本26.XX
的支持库,但每次我建立一个使用新版本我得到这个错误的项目:
Error:(357) Attribute "font" already defined with incompatible format.
Error:(343) Original attribute defined here.
Error:java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException: Error while executing
process /Users/johnsmith/Library/Android/sdk/build-tools/26.0.1/aapt
with arguments {package -f --no-crunch -I ...
I have tried cleaning and rebuilding. 我尝试过清洁和重建。 I have also tried invalidating caches and restarting Android Studio.
我也试过使缓存失效并重新启动Android Studio。
The app builds fine with version 25.3.1
of the support library. 该应用程序可以使用支持库的
25.3.1
版进行构建。 I'm using Android Studio 3.0 Beta 2 with version 3.0.0-beta2
of the Android Gradle plugin. 我正在使用Android Studio 3.0 Beta 2和Android Gradle插件的
3.0.0-beta2
版本。
Since this error is: 由于此错误是:
font
attribute, and font
属性相关的,和 aapt
, aapt
引发的错误, my guess is that you have defined a custom attribute named font
in your application code that conflicts in some manner with the android
-namespaced font
attribute introduced in Android O . 我的猜测是你在应用程序代码中定义了一个名为
font
的自定义属性,它与Android O中引入的android
-namespaced font
属性有某种冲突。 Try renaming or removing that custom attribute. 尝试重命名或删除该自定义属性。
you should change the "font" attribute name that used in customView 您应该更改customView中使用的“font”属性名称
<declare-styleable name="AATextView">
<attr name="font" format="string"/>
</declare-styleable>
for example : 例如 :
<declare-styleable name="AATextView">
<attr name="typeface" format="string"/>
</declare-styleable>
I faced the same issue when i updated supporting library to latest version. 当我将支持库更新到最新版本时,我遇到了同样的问题。
After that i have updated all the supporting library to latest version like play services library and firebase library also other third party libraries into latest version. 之后我将所有支持库更新到最新版本,如播放服务库和firebase库以及其他第三方库到最新版本。
I was getting the same issue and fixed in following way. 我得到了同样的问题,并按照以下方式修复。
This is issue comes when you upgrade your project to support Android 'O'. 当您升级项目以支持Android'O'时会出现此问题。 You can fix the issue with below step.
您可以通过以下步骤解决问题。 1. Check all the support library must have some version.
1.检查所有支持库必须有一些版本。 2. check res folder of all "External Dependency".
2.检查所有“外部依赖”的res文件夹。 you will find the culprit dependency resource file which actually creates the issue.
你会发现实际上产生问题的罪魁祸首依赖资源文件。 check this image for reference
查看此图片以供参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.