配置“属性"的资源“属性/字体"的重复值 [英] Duplicate value for resource 'attr/font' with config "

查看:19
本文介绍了配置“属性"的资源“属性/字体"的重复值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在真的知道为什么我会遇到这个错误以及如何解决它.实际上,我不确定在收到此 error 之前我做了什么.

I really do now know why I got this error and how can I solve it. Actually I am not sure What I did right before I got this error.

错误消息:/Users/hyun/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.1.arr/25699caf34fef6313d6ec32013a1a117f/res/values/values.xml错误:资源属性/字体"与配置的重复值".错误:先前在此处定义的资源

Error Msg: /Users/hyun/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.1.arr/25699caf34fef6313d6ec32013a1a117f/res/values/values.xml error:duplicate value for resource 'attr/font' with config". error: resource previously defined here

/Users/hyun/Desktop/Laftel-Android/app/build/intermediates/incremental/mergeDbugResources/merged.dir/values/values.xml资源attr/font"的重复值与配置.先前在此处定义的资源.

/Users/hyun/Desktop/Laftel-Android/app/build/intermediates/incremental/mergeDbugResources/merged.dir/values/values.xml duplicate value for resource 'attr/font' with config ". resource previously defined here.

Java.util.concurrent.ExecutionException:com.android.tools.appt2.Aapt2Exception:AAPT2 错误:检查详细信息 任务 ':app::mergeDebugResources' 执行失败.错误:java.utilconcurrentExcutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2 错误:检查日志以获取详细信息

Java.util.concurrent.ExecutionException:com.android.tools.appt2.Aapt2Exception:AAPT2 error: check for details Execution failed for task ':app::mergeDebugResources'. Error: java.utilconcurrentExcutionException:com.android.tools.aapt2.Aapt2Exception : AAPT2 error: check logs for details

推荐答案

这可能与我们之前用于应用自定义字体的逻辑发生冲突.

It may the concept that makes conflicts with the logic that we have previously used for apply Custom fonts.

以前

我们使用以下代码为字体创建自定义属性.

We have used below code for creating the custom attribute for the font.

    <declare-styleable name="CustomFont">
        <attr name="font" format="string" />
    </declare-styleable>

我改变了什么

就我而言,这就是问题所在,我已通过重命名 attr 名称解决了这个问题

In my case, this was the issue and I have resolved it by renaming the attr name

    <declare-styleable name="CustomFont">
        <attr name="fontName" format="string" />
    </declare-styleable>

如果您使用具有字体" 属性的任何第三方库或自定义视图

This same thing may apply if you are using any third party library or Custom View with "font" property

根据 reverie_ss 的建议,请检查您的 res->values->attrs.xml

As per suggestion by reverie_ss Please Check your res->values->attrs.xml

这篇关于配置“属性"的资源“属性/字体"的重复值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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