fat-aar-android icon indicating copy to clipboard operation
fat-aar-android copied to clipboard

多个 declare-styleable 中重复声明了一个attr,导致打出来的aar会提示—Error: Found item Attr/** more than one time

Open MoonBlueSky opened this issue 3 years ago • 7 comments

Describe the issue

在使用合并远程库的aar过程中发现问题, 多个依赖中存在 declare-styleable 中重复声明了同一个attr, 导致使用打出来的aar会提示—Error: Found item Attr/** more than one time

Build Environment

  • Operating System: [e.g. Windows 10]
  • Gradle Plugin Version: [e.g. 4.0.0]
  • Gradle Version: [e.g. 6.1.1]
  • Fat-aar Version: [e.g. 1.3.6]

这个问题好像是导入'androidx.appcompat:appcompat:1.2.0'和'androidx.core:core:1.2.0'会出现, 或者是其他拥有相同attr属性没有经过判断就被合并起来, 最后就是会提示有多个declare-styleable中重复的声明了同一个attr, 需要把它手动提取attr出来进行复用,但是很多库会有这种重复 例如:'com.google.android.material:material:1.2.1'和'androidx.appcompat:appcompat:1.2.0'中 都存在了 <attr format="color" name="backgroundTint"/> 他们分别位于 <declare-styleable name="Tooltip"><declare-styleable name="ViewBackgroundHelper">中 正常处理应该修改这两者中的为 <attr name="backgroundTint"/> 然后再定义一个公用的 <attr format="color" name="backgroundTint"/> 就可以解决这个冲突,这一部分需要进行修复,gradle编译时不存在该问题,应该是有进行了此步操作 @kezong

MoonBlueSky avatar Jun 28 '21 09:06 MoonBlueSky

我也遇到这个问题,请尽快解决哈哈,麻烦大佬了

UncleSugar avatar Aug 06 '21 11:08 UncleSugar

Describe the issue

在使用合并远程库的aar过程中发现问题, 多个依赖中存在 declare-styleable 中重复声明了同一个attr, 导致使用打出来的aar会提示—Error: Found item Attr/** more than one time

Build Environment

  • Operating System: [e.g. Windows 10]
  • Gradle Plugin Version: [e.g. 4.0.0]
  • Gradle Version: [e.g. 6.1.1]
  • Fat-aar Version: [e.g. 1.3.6]

这个问题好像是导入'androidx.appcompat:appcompat:1.2.0'和'androidx.core:core:1.2.0'会出现, 或者是其他拥有相同attr属性没有经过判断就被合并起来, 最后就是会提示有多个declare-styleable中重复的声明了同一个attr, 需要把它手动提取attr出来进行复用,但是很多库会有这种重复 例如:'com.google.android.material:material:1.2.1'和'androidx.appcompat:appcompat:1.2.0'中 都存在了 <attr format="color" name="backgroundTint"/> 他们分别位于 <declare-styleable name="Tooltip"><declare-styleable name="ViewBackgroundHelper">中 正常处理应该修改这两者中的为 <attr name="backgroundTint"/> 然后再定义一个公用的 <attr format="color" name="backgroundTint"/> 就可以解决这个冲突,这一部分需要进行修复,gradle编译时不存在该问题,应该是有进行了此步操作 @kezong

俺也遇到这个问题了,有解决吗?现在1.3.6的版本

kakaxicm avatar Nov 16 '21 09:11 kakaxicm

俺也遇到这个问题了,有解决吗?现在1.3.6的版本

yyt231 avatar Dec 22 '21 07:12 yyt231

同 怎么处理呢

SunSeekerX avatar Jan 12 '22 08:01 SunSeekerX

“就可以解决这个冲突,这一部分需要进行修复,gradle编译时不存在该问题,应该是有进行了此步操作 @kezong” gradle编译的时候并没有解决这个问题,你可以试一下,如果是源码直接打成apk的话,会有多个相同的attr定义,但是不会报错,至于为啥,暂时还不知道...

monkeydbobo avatar Jul 14 '22 12:07 monkeydbobo

1.3.8这个问题还是存在,求解决啊

zhangguannan avatar Jul 15 '22 07:07 zhangguannan

我的做法是exclude掉appcompat,目前没有报错了

biginsect avatar Aug 29 '22 11:08 biginsect