简体   繁体   English

Android支持库Build v26.XX构建错误:已定义属性“font”

[英]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: 由于此错误是:

  • Android O specific, Android O特定,
  • related to a font attribute, and font属性相关的,和
  • an error thrown by 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.

相关问题 Android支持库内部版本v26.XX内部版本错误:属性“ fontFamily”已使用不兼容的格式定义 - Android Support Library Build v26.X.X Build Error: Attribute “fontFamily” already defined with incompatible format Android支持库Build V 25错误 - Android Support library Build V 25 error Android设计支持和其他库给出了gradle构建错误:“ headerLayout”已经定义 - Android design support and other library give gradle build error: “headerLayout” has already been defined 使用支持库设计v 23.1.1时,属性“ borderWidth”已定义为错误 - Attribute “borderWidth” already defined error while using Support Library Design v 23.1.1 Android 构建错误:程序类型已存在:android.support.v7.app.** - Android build error: Program type already present: android.support.v7.app.** 使用支持库我得到一个错误,已经在android中定义了属性“” - while using support library i am getting an error that Attribute “ ” has already been defined in android 字体已在Android Gradle构建中以不兼容的格式定义 - Font already defined with incompatible format in Android Gradle build Android 支持库不存在但无法编辑“Build”文件夹下的文件以引用 Android X - Android support library doesn't exist but can't edit files under "Build" folder to reference Android X “ v17 leanback库”(android电视支持库)可以支持2.x或4.x设备吗? - Can “v17 leanback library”(android tv support library) support 2.x or 4.x device? 禁用Android支持库ADT:内部版本:v22.6.2-1085508 - Disable Android Support Library ADT: Build: v22.6.2-1085508
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM