I added a library to my project in Android Studio. But as soon as I tried to compile my project I got this error:
Attribute barColor has already been declared.
After that I checked the whole project and noticed that another library is already declaring that same attribute!
How can I fix this conflict or can I just not use those libraries at the same time?
The libraries which are causing the conflict are:
Best How To :
The easiest fix for this is to just rename the attribute in one of the libraries. To do that you have to:
- Download the source code of one of the libraries and add it to your project.
- Now you have to rename the attribute in the source code you just downloaded. The simplest way to do that is through refactoring. So right click on the attribute in question and select refactoring -> rename. Alternatively just place your cursor on the attribute and hit Shift + F6. Then enter a new name for the attribute.
- Most of the time the refactoring should already do all the work for you, but sometimes you need to fix a few things manually after refactoring. Just try rebuilding your project until you don't get any compile errors and fix errors as they come up.
After that you should be all set. Now that the attributes have different names there shouldn't be any conflict!