Ali_Waris
Ali_Waris

Reputation: 2382

Same name resources conflict from different libraries

I have multiple third party libraries added in my application. I am using some resources for ex: R.drawable.ic_logo and want to reference that icon from one of the added libraries.

But, it always takes the icon from my app's local resources, since there is same name ic_logo resource in my app.

How to fix this?

Upvotes: 2

Views: 2224

Answers (1)

hata
hata

Reputation: 12513

You can't fix this without renaming. For it is a designed behavior.

Android Studio > User guide: Create an Android library: Development considerations for library modules

Resource merge conflicts

The build tools merge resources from a library module with those of a dependent app module. If a given resource ID is defined in both modules, the resource from the app is used.

The only workaround is to rename the resource file in your app module to avoid conflict.

Upvotes: 3

Related Questions