Lollipop AppCompat-v7 21 - Attribute "theme" has already been defined

I had the first issue as well. It can be fixed by updating the Google Play Services dependency to 6.1.+.

In Gradle (which I hope you are using) this is: compile 'com.google.android.gms:play-services:6.1.+'

As for the second issue - as people have said in the comments, you should make sure ALL the components in your SDK installation are up to date.


I had the same problem but upgrade to latest versions doesn't helped.

But error message Attribute “theme” has already been defined changed to Attribute “layout” has already been defined

In Google Play Services changes I've found this

  <declare-styleable name="WalletFragmentOptions">
         <!-- Theme to be used for the Wallet selector -->
-        <attr name="theme" format="enum">
+        <attr name="appTheme" format="enum">

And this is the key.

If you have in your attr.xml attributes theme or layout or maybe something else - rename it. It seems merger can't deal with it.


Gradle in the Android studio suggests the latest version of com.google.android.gms:play-services. After updating that to the latest version, the problem got solved.

compile 'com.google.android.gms:play-services:8.3.0'