When using dependencies in my build.gradle file:
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
I'm getting error:
Attribute \"theme\" has already been defined
in my colors.xml. If I change my dependency to
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
It seems to work - I don't get the error. But I don't want to include the full play services, I just want location services.
Why am I getting this error when only including location services, and how do I fix it?
NOTE: I'm aware of existing questions about this but the answers state to just use the "latest" versions and were referring to play services 6.x. I'm using play services 7.5 and getting the error, so this is something different.
After lots of guesswork and failed trial and error I discovered that my old dependency on segment.io was including Play Services library and it was now including the full version of an older library since I wasn’t.
The problem is Google Wallet. I found an attribute “theme” defined in Wallet’s attrs.xml. Defining an attribute named “theme” is not the best idea ever, since it has to be used by the AppCompat library to replace the Android system theme attribute. So this file has the problem:
I fixed the issue by replacing this:
With this:
I put up a full blog post about this right here on my blog.