在 Android Studio 0.5.8 中向 Action Bar Sherlock 添加依赖项后出错 [英] Error after adding dependencies to Action Bar Sherlock in Android Studio 0.5.8
问题描述
好的,我知道这个问题已经被问了很多......而且,我也尝试了在 SO 中发布的几种方法.但似乎没有一个对我有用.
Okay, i know this question have been asked a lot.. And, i also have tried several methods posted in SO. But none seems to work for me.
所以,这就是我的做法.我在我的 gradle 文件中的依赖项中添加了这行代码:
So, here's how i do it. I add this line of code inside dependencies in my gradle files:
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
但是当我尝试将我的项目与 gradle 同步时,它给了我以下错误:
But then when i try to sync my project with gradle, it gives me these error:
Gradle invocation completed successfully with 75 error(s) in 30 sec
这些是错误:
D:\RandomProjects\SwipeExperiment\SwipeExperiment\build\exploded-aar\com.android.support\appcompat-v7\19.1.0\res\values\values.xml
Error:Attribute "titleTextStyle" has already been defined
Error:Attribute "subtitleTextStyle" has already been defined
Error:Attribute "divider" has already been defined
Error:Attribute "background" has already been defined
Error:Attribute "backgroundSplit" has already been defined
Error:Attribute "actionDropDownStyle" has already been defined
Error:Attribute "dropdownListPreferredItemHeight" has already been defined
Error:Attribute "popupMenuStyle" has already been defined
D:\RandomProjects\SwipeExperiment\SwipeExperiment\build\exploded-aar\com.actionbarsherlock\actionbarsherlock\4.4.0\res\values\values.xml
Error:Attribute "navigationMode" has already been defined
Error:Attribute "displayOptions" has already been defined
Error:Attribute "title" has already been defined
Error:Attribute "subtitle" has already been defined
Error:Attribute "icon" has already been defined
Error:Attribute "logo" has already been defined
Error:Attribute "backgroundStacked" has already been defined
.
.
.
Error:Attribute "windowActionBarOverlay" has already been defined
Error:Attribute "windowSplitActionBar" has already been defined
Error:Attribute "listPopupWindowStyle" has already been defined
Error:Attribute "activityChooserViewStyle" has already been defined
推荐答案
你的项目依赖于 appcompat-v7
和 ActionBarSherlock
.它们都提供相同的功能并定义相同的样式属性 - 这是相互冲突的.
Your project depends on both appcompat-v7
and ActionBarSherlock
. They both provide the same functionality and define the same style attributes - which are conflicting.
删除 ActionBarShelock
或 appcompat-v7
库.
我建议使用 appcompat-v7
中的 ActionBar
而不是 ActionBarSherlock
.
I recommend using ActionBar
from appcompat-v7
rather than ActionBarSherlock
.
这篇关于在 Android Studio 0.5.8 中向 Action Bar Sherlock 添加依赖项后出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!