Gradle错误:资源'attr/font'的值与config“;解决方案不起作用 [英] Gradle Error : Duplicate value for resource 'attr/font' with config " solutions not working

查看:227
本文介绍了Gradle错误:资源'attr/font'的值与config“;解决方案不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的第一个Android应用程序创建圆形按钮.

I am trying to create circular shaped buttons for my first android app.

为此,我将库添加为 在circlebutton/app/build.gradle中的compile 'com.cuboid:cuboidcirclebutton:1.0.5'

For that, I added the library as compile 'com.cuboid:cuboidcirclebutton:1.0.5' in circlebutton/app/build.gradle

当我同步时,出现错误.下面是日志

As I sync, I get errors. below is the log

Information:Gradle tasks [clean, :app:assembleDebug]
C:\Users\Amninder\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\2d55d8c33dae479e599960c08d012b17\res\values\values.xml
Error:(246, 5) error: duplicate value for resource 'attr/font' with config ''.
Error:(246, 5) error: resource previously defined here.

C:\Users\Amninder\AndroidStudioProjects\circlebutton\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:(254) duplicate value for resource 'attr/font' with config ''.

Error:(240) resource previously defined here.

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

 Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Information:BUILD FAILED in 19s
Information:6 errors
Information:0 warnings
Information:See complete output in console`

以下是我尝试过和失败过的事情的清单.

Below is a list of things I tried and failed.

1.在第254行删除attr/font>保存全部>清理项目>重建项目.

1.removing attr/font on line 254 > doing save all > clean project > rebuild project.

  1. 我受到了这段youtube视频的启发- https://www.youtube.com /watch?v = dF0m_PG111g ,所以在评论"部分中进行了检查.第一条评论是相同的错误.因此,请检查此 guy的博客.所以我知道错误是因为仅添加了库.所以我在Google上搜索了-如何在android

  1. I was inspired by this youtube video - https://www.youtube.com/watch?v=dF0m_PG111g so checked in it's comments section. First comment was the same error. So, checked this guy's blog. So I got to know the error was because of adding the library only. So I searched on google for - how to add custom library in android referred this. opened it and there was no info. regarding the error I am facing.

这次从stackoverflow看到了视频上的另一个链接.

Saw another link on the video, from stackoverflow this time.here is the link.He says "After renaming the library attribute to something else (textFont), all went good again." I also tried renaming the attr/font to attr/1txtfont but changes were not reflected at all.

这里有人可以帮我吗?

推荐答案

您正在使用支持库版本26 ,该库定义了属性attr/font,并且该库定义了相同的属性,这是导致此问题的原因错误.

You're using support library version 26 which defines attribute attr/font and the library defines the same attribute, this is what causes the error.

因此您可以使用支持库 version< 26 ,例如:com.android.support:appcompat-v7:25.3.1.还是库所有者重命名该属性

So you either use support library version < 26, for example: com.android.support:appcompat-v7:25.3.1. Or the library owner rename the attribute

这篇关于Gradle错误:资源'attr/font'的值与config“;解决方案不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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