Error:Attribute “theme” has already been defined

后端 未结 5 1923
既然无缘
既然无缘 2020-12-31 01:29

I am using Android studio for building application. I am using this following dependencies:

  1. play services : compile \'com.google.android.gms:play-servic
相关标签:
5条回答
  • 2020-12-31 01:51

    I had the same issue developing in Eclipse after updating content via the SDK manager.

    I had to completely remove the Google Play Services library from the Workspace and then copy and import the updated version following the instructions here.

    No updating of the referenced jars helped me - Only a full fresh import. This included updating the android-support-v7-appcompat import.

    0 讨论(0)
  • 2020-12-31 01:59

    just use latest (21)
    appCompat and
    google play services library

    For example:

    compile 'com.android.support:support-v4:21.0.0'
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile 'com.android.support:recyclerview-v7:21.0.0' 
    compile 'com.android.support:cardview-v7:21.0.0'
    compile 'com.google.android.gms:play-services:6.1.11'
    

    then everything works :)

    0 讨论(0)
  • 2020-12-31 02:03

    Just check, whether you have a file named attrs.xml. In that file replace the following line

     <attr name="theme" format="reference" />
    

    with

     <attr name="apptheme" format="reference" />
    

    That is, rename the theme name. Now clean the project. This solved my issue.

    0 讨论(0)
  • 2020-12-31 02:12

    If you want to keep supporting older android versions (2.3.x, 3.x.x, 4.0) use a modified version of your library removing wallet classes and resources (given that you don't need wallet functionality.) That avoids this "theme" attr problem. I am using play-services-5.0.89.arr with no problem.

    In particular, remove com.google.android.gms.wallet.* classes and wallet_*.xml resources and you are done.

    0 讨论(0)
  • 2020-12-31 02:16

    Thanks Hirak as you mentioned the error was with dependency. solved it using following versions of library:

    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.google.android.gms:play-services:4.+'
    compile 'com.android.support:cardview-v7:21.0.0'
    compile 'com.android.support:recyclerview-v7:21.0.0'
    
    0 讨论(0)
提交回复
热议问题