将 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}
- 还将 supportLibs 放回到 25 告诉我同样的错误。
- 删除构建文件夹没有帮助
在我的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"/>
最佳答案
重命名自定义 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/