Reputation: 92
I'm encountering a duplicate resource error during my Android project build. The error message is:
`Modules 'base' and 'ModuleX' contain entry 'res/drawable/ic_cut.xml' with different content.`
Project Setup:
ModuleX (Dynamic Module):
`implementation("library_group:module-core:VERSION_X",{
exclude group: 'graphics_library', module: 'graphics-module'
})`
App Module:
`implementation("graphics_library:graphics-module:GRAPHICS_VERSION")`
It seems that the graphics_library is included both directly in the app module and transitively through another dependency, possibly with a different version. As a result, ic_cut.xml appears in both base and ModuleX, but with different content.
What I've Tried:
Forcing a Single Version:
`configurations.all {
resolutionStrategy {
force 'graphics_library:graphics-module:GRAPHICS_VERSION'
}
}`
However, the error still persists.
Upvotes: 0
Views: 21
Reputation: 92
I fixed this by creating a duplicate value in my dynamic module with a different name and overriding it in the affected file.
<resources>
<item name="ic_cut" type="drawable">@drawable/ic_cut_wb</item>
</resources>
Upvotes: 0