在Android Studio 0.5.8中向Action Bar Sherlock添加依赖项后出错该怎么办?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (45)

我在我的gradle文件中的依赖关系中添加了这行代码:

compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'

但是当我尝试使用gradle同步我的项目时,它给了我这些错误:

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-v7ActionBarSherlock。它们都提供相同的功能并定义相同的样式属性 - 这些属性是相互冲突的。

删除ActionBarShelockappcompat-v7库。

我建议使用ActionBar来自appcompat-v7而非ActionBarSherlock

扫码关注云+社区