Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MoonBlueSky opened this issue Jun 28, 2021 · 7 comments

Comments

@MoonBlueSky
Copy link

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

@UncleSugar
Copy link

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

@kakaxicm
Copy link

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的版本

@yyt231
Copy link

yyt231 commented Dec 22, 2021

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

@SunSeekerX
Copy link

同 怎么处理呢

@monkeydbobo
Copy link

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

@zhangguannan
Copy link

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

@biginsect
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants