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

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

问题描述

我现在确实知道为什么得到了这个error以及如何解决它. 实际上,我不确定在获得此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 错误:资源'attr/font'与config重复的值. 错误:先前在此处定义的资源

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'与config的重复值. 先前在此处定义的资源.

/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>

如果您正在使用具有"font" 属性的任何第三方库或自定义视图,则可能会发生同样的事情

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天全站免登陆