错误:属性"主题"已定义 [英] Error:Attribute "theme" has already been defined
本文介绍了错误:属性"主题"已定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是Android工作室创建应用程序。我用这以下的依赖:
- 播放服务:
编译com.google.android.gms:玩-服务:08年2月5日
- 在应用实战V7:
编译com.android.support:appcompat-v7:21.0.0
- 支持Cardview:
编译com.android.support:cardview-v7:21.0.0
- 支持回收站观点:
编译com.android.support:recyclerview-v7:21.0.0
我收到以下错误,同时建立我的应用程序:
<$p$p><$c$c>app/build/intermediates/exploded-aar/com.google.android.gms/play-services/5.2.08/res/values/wallet_attrs.xml 错误:属性的主题已经被定义
code Styles.xml
&LT;资源&GT;
&LT;! - 基本应用主题。 - &GT;
&LT;样式名称=AppTheme父=Theme.AppCompat.Light.DarkActionBar&GT;
&LT;! - 自定义你的主题在这里。 - &GT;
&LT; /风格&GT;
&LT; /资源&GT;
code wallet_attrs.xml
&LT; XML版本=1.0编码=UTF-8&GT?;
&LT; - !版权所有2014年谷歌公司保留所有权利。 - &GT;
&LT;资源&GT;
&LT;! - 属性的WalletFragment和放大器; LT;片段和放大器; GT;标签 - &GT;
&LT;申报,设置样式名称=WalletFragmentOptions&GT;
&所述;! - 用于在电子钱包选择主题 - &GT;
&LT; attr指示名称=主题格式=枚举&GT;
&LT;枚举名=holo_dark值=0/&GT;
&LT;枚举名=holo_light值=1/&GT;
&LT; / ATTR&GT;
&LT;! - 谷歌钱包的环境中使用 - &GT;
&LT; attr指示NAME =环境格式=枚举&GT;
&LT;枚举名=生产值=1/&GT;
&LT;枚举名=沙箱值=0/&GT;
&LT;枚举名=strict_sandbox值=2/&GT;
&LT; / ATTR&GT;
&LT;! - 样式资源specifing属性自定义WalletFragment的外观和感觉 - &GT;
&LT; attr指示NAME =fragmentStyle格式=参考/&GT;
&所述;! - 片段模式 - &GT;
&LT; attr指示NAME =fragmentMode格式=枚举&GT;
&LT;枚举名=buyButton值=1/&GT;
&LT;枚举名=selectionDetails值=2/&GT;
&LT; / ATTR&GT;
&LT; /申报,设置样式&GT;
&LT;! - 这可以在样式资源属性来指定定制的外观和感觉
WalletFragment - &GT;
&LT;申报,设置样式名称=WalletFragmentStyle&GT;
&LT;! - 购买按钮的高度。这包括用于一个8DP填充(4DP每侧)
pressed和按钮的聚焦状态。该值可以是一个特定的高度,例如
48dp,或特殊值match_parent和WRAP_CONTENT。 - &GT;
&LT; attr指示NAME =buyButtonHeight格式=尺寸&GT;
&LT;枚举名=match_parent值= - 1/&GT;
&LT;枚举名=WRAP_CONTENT值= - 2/&GT;
&LT; / ATTR&GT;
&LT;! - 宽购买按钮的。这包括用于一个8DP填充(4DP每侧)
pressed和按钮的聚焦状态。该值可以是一个特定的宽度,例如
300dp,或特殊值match_parent和WRAP_CONTENT。 - &GT;
&LT; attr指示NAME =buyButtonWidth格式=尺寸&GT;
&LT;枚举名=match_parent值= - 1/&GT;
&LT;枚举名=WRAP_CONTENT值= - 2/&GT;
&LT; / ATTR&GT;
&LT;! - 购买按钮文字。必须是buy_with_google,buy_now和book_now一 - &GT;
&LT; attr指示NAME =buyButtonText格式=枚举&GT;
&LT;枚举名=buy_with_google值=1/&GT;
&LT;枚举名=buy_now值=2/&GT;
&LT;枚举名=book_now值=3/&GT;
&LT; / ATTR&GT;
&LT;! - 购买按钮的外观。必须是经典,灰度和黑白一 - &GT;
&LT; attr指示NAME =buyButtonAppearance格式=枚举&GT;
&LT;枚举名=经典值=1/&GT;
&LT;枚举名=灰度值=2/&GT;
&LT;枚举名=单色值=3/&GT;
&LT; / ATTR&GT;
&LT;! - TextAppearance蒙面钱包细节 - &GT;
&LT; attr指示NAME =maskedWalletDetailsTextAppearance格式=参考/&GT;
&LT;! - TextAppearance的标题描述蒙面钱包细节 - &GT;
&LT; attr指示NAME =maskedWalletDetailsHeaderTextAppearance格式=参考/&GT;
&LT;! - 蒙面钱包细节背景 - &GT;
&LT; attr指示NAME =maskedWalletDetailsBackground格式=引用|色/&GT;
&LT;! - TextAppearance在屏蔽钱包细节更改按钮来查看 - &GT;
&LT; attr指示NAME =maskedWalletDetailsButtonTextAppearance格式=参考/&GT;
&LT;! - 更改按钮背景蒙面钱包详细信息视图 - &GT;
&LT; attr指示NAME =maskedWalletDetailsButtonBackground格式=引用|色/&GT;
&LT;! - 在屏蔽钱包细节的谷歌钱包的标志文字的彩色照片 - &GT;
&LT; attr指示NAME =maskedWalletDetailsLogoTextColor格式=颜色/&GT;
&LT;! - 在屏蔽钱包细节钱包的标志图像类型查看 - &GT;
&LT; attr指示NAME =maskedWalletDetailsLogoImageType格式=枚举&GT;
&LT;枚举名=经典值=1/&GT;
&LT;枚举名=单色值=2/&GT;
&LT; / ATTR&GT;
&LT; /申报,设置样式&GT;
&LT; /资源&GT;
解决方案
只需使用最新的(21)
appCompat和
谷歌播放服务库
例如:
编译com.android.support:support-v4:21.0.0
编译com.android.support:appcompat-v7:21.0.0
编译com.android.support:recyclerview-v7:21.0.0
编译com.android.support:cardview-v7:21.0.0
编译com.google.android.gms:播放服务:6.1.11
然后一切正常:)
I am using Android studio for building application. I am using this following dependencies:
- play services :
compile 'com.google.android.gms:play-services:5.2.08'
- app combat v7 :
compile 'com.android.support:appcompat-v7:21.0.0'
- support Cardview :
compile 'com.android.support:cardview-v7:21.0.0'
- support Recycler view :
compile 'com.android.support:recyclerview-v7:21.0.0'
I am getting following error while building my app:
app/build/intermediates/exploded-aar/com.google.android.gms/play-services/5.2.08/res/values/wallet_attrs.xml
Error:Attribute "theme" has already been defined
Code Styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
Code wallet_attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2014 Google Inc. All Rights Reserved. -->
<resources>
<!-- Attributes for the WalletFragment <fragment> tag -->
<declare-styleable name="WalletFragmentOptions">
<!-- Theme to be used for the Wallet selector -->
<attr name="theme" format="enum">
<enum name="holo_dark" value="0"/>
<enum name="holo_light" value="1"/>
</attr>
<!-- Google Wallet environment to use -->
<attr name="environment" format="enum">
<enum name="production" value="1"/>
<enum name="sandbox" value="0"/>
<enum name="strict_sandbox" value="2"/>
</attr>
<!-- A style resource specifing attributes to customize the look and feel of WalletFragment -->
<attr name="fragmentStyle" format="reference"/>
<!-- Fragment mode -->
<attr name="fragmentMode" format="enum">
<enum name="buyButton" value="1"/>
<enum name="selectionDetails" value="2"/>
</attr>
</declare-styleable>
<!-- Attributes that may be specified in a style resource to customize the look and feel of
WalletFragment -->
<declare-styleable name="WalletFragmentStyle">
<!-- Height of the buy button. This includes an 8dp padding (4dp on each side) used for
pressed and focused states of the button. The value can be a specific height, e.g.
"48dp", or special values "match_parent" and "wrap_content". -->
<attr name="buyButtonHeight" format="dimension">
<enum name="match_parent" value="-1" />
<enum name="wrap_content" value="-2" />
</attr>
<!-- Width of the buy button. This includes an 8dp padding (4dp on each side) used for
pressed and focused states of the button. The value can be a specific width, e.g.
"300dp", or special values "match_parent" and "wrap_content". -->
<attr name="buyButtonWidth" format="dimension">
<enum name="match_parent" value="-1" />
<enum name="wrap_content" value="-2" />
</attr>
<!-- Text on the buy button. Must be one of "buy_with_google", "buy_now" and "book_now" -->
<attr name="buyButtonText" format="enum">
<enum name="buy_with_google" value="1"/>
<enum name="buy_now" value="2"/>
<enum name="book_now" value="3"/>
</attr>
<!-- Appearance of the buy button. Must be one of "classic", "grayscale" and "monochrome" -->
<attr name="buyButtonAppearance" format="enum">
<enum name="classic" value="1"/>
<enum name="grayscale" value="2"/>
<enum name="monochrome" value="3"/>
</attr>
<!-- TextAppearance for masked wallet details -->
<attr name="maskedWalletDetailsTextAppearance" format="reference"/>
<!-- TextAppearance for headers describing masked wallet details -->
<attr name="maskedWalletDetailsHeaderTextAppearance" format="reference"/>
<!-- Masked wallet details background -->
<attr name="maskedWalletDetailsBackground" format="reference|color"/>
<!-- TextAppearance for the "Change" button in masked wallet details view -->
<attr name="maskedWalletDetailsButtonTextAppearance" format="reference"/>
<!-- "Change" button background in masked wallet details view -->
<attr name="maskedWalletDetailsButtonBackground" format="reference|color"/>
<!-- Color of the Google Wallet logo text in masked wallet details view -->
<attr name="maskedWalletDetailsLogoTextColor" format="color"/>
<!-- Type of the wallet logo image in masked wallet details view -->
<attr name="maskedWalletDetailsLogoImageType" format="enum">
<enum name="classic" value="1"/>
<enum name="monochrome" value="2"/>
</attr>
</declare-styleable>
</resources>
解决方案
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 :)
这篇关于错误:属性&QUOT;主题&QUOT;已定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文