Cha*_*Eun 39 android android-resources
我现在真的知道为什么我得到这个error,我该如何解决它.其实我不确定在得到这个之前我做了什么error.
错误消息:/Users/hyun/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.1.arr/25699caf34fef6313d6ec32013a1a117f/res/values/values.xml错误:资源'attr/font的重复值'with config'.错误:此前定义的资源
/Users/hyun/Desktop/Laftel-Android/app/build/intermediates/incremental/mergeDbugResources/merged.dir/values/values.xml资源'attr/font'的重复值,其中包含先前在此定义的配置资源.
Java.util.concurrent.ExecutionException:com.android.tools.appt2.Aapt2Exception:AAPT2错误:检查详细信息任务':app :: mergeDebugResources'的执行失败.错误:java.utilconcurrentExcutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息
Tar*_*iya 39
可能与我们之前使用的逻辑冲突的概念应用自定义字体.
先前
我们使用下面的代码来创建字体的自定义属性.
<declare-styleable name="CustomFont">
<attr name="font" format="string" />
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)
我改变了什么
在我的情况下,这是问题,我通过重命名attr名称解决了它
<declare-styleable name="CustomFont">
<attr name="fontName" format="string" />
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)
如果您使用任何第三方库或具有"font"属性的自定义视图,则同样的事情可能适用
根据reverie_ss的建议请检查你的res-> values-> attrs.xml
Ped*_*lez 36
支持库26将字体属性添加到像TextView等xml元素.在我的情况下,我使用的是具有自定义视图的库和自定义属性app:font,因此它们发生了冲突.将库属性重命名为其他内容(textFont)后,一切都恢复正常.那么,你在某处使用自定义'font'属性吗?您最近是否更新了gradle以支持图书馆26或27?如果您无法覆盖属性名称,请尝试回滚到25
luc*_*ler 14
迁移到AndroidX后,我的错误消息是
error: duplicate value for resource 'attr/progress' with config ''
我有一个为自定义视图定义的自定义属性,如下所示:
<declare-styleable name="ProductionProgressItemView">
<attr name="progressTitle" format="string"/>
<attr name="progress" format="string"/>
<attr name="progressPercent" format="integer"/>
Run Code Online (Sandbox Code Playgroud)
将进度重命名为progressValue修复了该问题.
小智 6
我将 android-X 库更新到了新版本,并且出现了此类错误styles.xml
error: duplicate value for resource 'attr/progress' with config ''
Run Code Online (Sandbox Code Playgroud)
这是我之前的代码
<declare-styleable name="CircleProgressBar">
<attr name="min" format="integer" />
<attr name="max" format="integer" />
<attr name="progress" format="integer" />
<attr name="progressbarColor" format="color" />
<attr name="progressBarThickness" format="dimension" />
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)
我progress通过将其重构为progressValue如下所示来更改属性值。
<declare-styleable name="CircleProgressBar">
<attr name="min" format="integer" />
<attr name="max" format="integer" />
<attr name="progressValue" format="integer" />
<attr name="progressbarColor" format="color" />
<attr name="progressBarThickness" format="dimension" />
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)
这对我有用。
| 归档时间: |
|
| 查看次数: |
36922 次 |
| 最近记录: |