简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM