16

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.

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'

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

These are the errors:

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

1 Answer 1

47

Your project depends on both appcompat-v7 and ActionBarSherlock. They both provide the same functionality and define the same style attributes - which are conflicting.

Either remove ActionBarShelock or appcompat-v7 library.

I recommend using ActionBar from appcompat-v7 rather than ActionBarSherlock.

Support library features. AppCompat

Adding the Action Bar

2
  • ah, i see.. i got the idea now. I never included appcompat-v7 library in my eclipse project, so basically it does the same thing as ABS. Gotta learn more about it.
    – Milanor
    Commented May 19, 2014 at 8:49
  • I recommend instead using ABS when dealing with Preference activities with action bar.
    – vault
    Commented Dec 4, 2014 at 14:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.