我正在尝试为我的第一个Android应用程序创建圆形按钮.
为此,我compile 'com.cuboid:cuboidcirclebutton:1.0.5'在circlebutton/app/build.gradle中添加了库
当我同步时,我收到错误.下面是日志
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`
Run Code Online (Sandbox Code Playgroud)
下面列出了我尝试过但失败的事情.
1.在第254行上删除attr/font>执行save all> clean project> rebuild project.
我受到了这个YouTube视频的启发 - https://www.youtube.com/watch?v=dF0m_PG111g,因此在其评论部分进行了检查.第一条评论是同样的错误.所以,检查了这 家伙的博客.所以我知道错误是因为只添加了库.所以,我搜索在谷歌-如何添加Android中自定义库称此.打开它,没有任何信息.关于我面临的错误.
这次在stackoverflow上看到了视频的另一个链接.这里是链接.他说"在将库属性重命名为其他东西(textFont)之后,一切都很好了." 我也尝试将attr/font重命名为attr/1txtfont,但根本没有反映出更改.
有人可以帮我解决这个问题吗?
您使用的支持库版本26定义了属性attr/font,并且库定义了相同的属性,这就是导致错误的原因。
因此,您可以使用版本<26的支持库,例如:com.android.support:appcompat-v7:25.3.1。或库所有者重命名属性
| 归档时间: |
|
| 查看次数: |
14503 次 |
| 最近记录: |