资源 'attr/drawableTintMode' 的重复值

duplicate value for resource 'attr/drawableTintMode'

构建项目时遇到此错误。

AAPT: error: duplicate value for resource 'attr/drawableTintMode' with config ''.

我已经完成了这个错误的解决方案,我认为它正在更改 attrs.xml 中的 attr 名称,但是在更改 attr 名称时,我的一些模块导致了问题。

那么有没有其他的解决办法呢

请注意 - 只有在我从

更新 facebook 登录 api 后才会出现此问题
'com.facebook.android:facebook-login:5.1.0' -> `'com.facebook.android:facebook-login:11.0.0'`

在“Task :app:mergeDebugResources”下的构建日志中,可能有类似于 ...jetified-facebook-login-11.0.0\res\values\values.xml:12:4: Duplicate value for resource 'attr/drawableTintMode' with config 'DEFAULT' and product ''. Resource was previously defined here: ....\jetified-libraryB-0.0.0.4\res\values\values.xml:6:4: . 行的内容 似乎 Android 无法处理任何库的任何属性具有相同名称

参见此处示例

如果你看看 https://issuetracker.google.com/issues/36936359#comment18

Basically what I had understood from this thread - if you are developing a lib you must take care about your users by prefixing your resources(sound good as for me)

如果你看一些像这样的图书馆:-

https://github.com/gcacace/android-signaturepad/commit/e09688542f11777baa550018cff9c3de2d659252

他们不得不重命名属性来解决这个问题。

有些喜欢:-

https://github.com/JakeWharton/ViewPagerIndicator/blob/master/library/res/values/vpi__attrs.xml

添加链接到库名称的前缀以防止属性冲突。

所以 facebook 库添加的 drawableTintMode 属性可能已被您正在使用的另一个库使用。

可能唯一的解决方法是让其中一个冲突库将属性 drawableTintMode 重命名为更独特的东西,方法是针对它们提出错误。