Error:Attribute “theme” has already been defined

你说的曾经没有我的故事 提交于 2019-11-30 08:06:56
cV2

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 :)

arunprakashpj

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.

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.

Emmanuel Harguindey

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.

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'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!