android - 错误 aapt : Attribute "font" already defined with incompatible format. 此处定义的原始属性

标签 android android-studio gradle aapt build-tools

将 supportlibs 更新到 27.0.2 并将编译版本更新到 27 后收到以下错误消息

Error:(252, 5) Attribute "font" already defined with incompatible format.

> /home/ralfi/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.1.aar/644e31926a52609e6fffe47c9016abcc/res/values/values.xml
> Error:(252, 5) Attribute "font" already defined with incompatible
> format. Error:(252, 5) Original attribute defined here.
> /home/ralfi/ProjectFolder/android-example/app/build/intermediates/res/merged/internal/debug/values/values.xml
> Error:(631) Attribute "font" already defined with incompatible format.
> Error:(607) Original attribute defined here.

还有这个:

> Error:java.util.concurrent.ExecutionException:
> com.android.ide.common.process.ProcessException: Error while executing
> process /opt/sdk/build-tools/26.0.2/aapt with arguments {package -f
> --no-crunch -I /opt/sdk/platforms/android-27/android.jar -M /home/ralfi/ProjectFolder/android-example/build/intermediates/manifests/full/internal/debug/AndroidManifest.xml
> -S /home/ralfi/ProjectFolder/android-example/build/intermediates/res/merged/internal/debug
> -m -J /home/ralfi/ProjectFolder/android-example/build/generated/source/r/internal/debug
> -F /home/ralfi/ProjectFolder/android-example/build/intermediates/res/internal/debug/resources-internalDebug.ap_
> -D /home/ralfi/ProjectFolder/android-example/build/intermediates/multi-dex/internal/debug/manifest_keep.txt
> --custom-package com.example.android -0 apk -c de,en --output-text-symbols /home/ralfi/ProjectFolder/android-example/build/intermediates/symbols/internal/debug
> --no-version-vectors}
  1. 还将 supportLibs 放回到 25 告诉我同样的错误。
  2. 删除构建文件夹没有帮助

在我的values/attrs.xml中编辑与字体相关的名称仅出现如下:

 <declare-styleable name="Styleable">
        <attr name="fontFace" format="string"/>
        <attr name="underlined" format="boolean"/>
        <attr name="android:lineSpacingMultiplier"/>
        <attr name="android:textSize"/>
 </declare-styleable>

和这个标签:

<attr name="minFontSize" format="reference|dimension"/>

Both Project and Module Gradle file

最佳答案

重命名自定义 TextView 类中的 type="font"并将其更改为任何其他名称 <attr name="font" format="string" /><attr name="typefont" format="string" />

并在每个 xml 文件中替换它 app:typefont="ProximaNova-Light.ttf"

关于android - 错误 aapt : Attribute "font" already defined with incompatible format. 此处定义的原始属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47815706/

相关文章:

gradle - 控制gradle任务执行顺序

android - 如何在 android 中以编程方式将数据添加到 Google 日历?

android - adb logcat -f log.txt 错误: couldn't open output file: Read-only file system

android - 如何在android studio中打开另一个项目

android - Android Studio-构建Android示例项目(无构建文件)?

android - 带有错误 :Cause: tried to access method 的 Gradle 构建

android - 如何从android调用导航网络服务

Android:如何使用 onDraw 方法模糊圆的边缘?

android - 底页不适用于 Kitkat( Lollipop 前设备)

android - 在 xml 上使用 android 前缀(android :, app :, @.., ...)