Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing ActionbarSherlock with Android Studio?

As many other Android Developers I installed Android Studio, but how do I install actionbarsherlock into Android Studio?

Any help? I have no idea where to even start.

like image 284
ryandawkins Avatar asked May 16 '13 00:05

ryandawkins


3 Answers

I also had a problem getting ActionBarSherlock running. I had an existing project, but it sounds like you simply want ABS From scratch. Here are step by step instructions of what to do :

1) Download ABS here: http://actionbarsherlock.com/

2) Extract ABS, you should have a directory in there called "actionbarsherlock". Copy that to your Android Studio workspace. and rename to ActionBarSherlock (changed casing) -- > I now have my Android Studio Projects under \*documents*\Android Workspace\ As opposed to \Eclipse Workspace\

So you should now have something like :

\*documents*\Android Workspace\ActionBarSherlock\

Along with your main project maybe:

\*documents*\Android Workspace\TestProject\

3) Open Android Studio load your TestProject then goto File> Import Module... Now navigate to ActionBarSherlock under \*documents*\Android Workspace\ActionBarSherlock\ Click Ok and next all the way to finish. It will ask if you want to set a dependancy to the new Module (or at least mine did) click OK

4) What i found at this point is that when compiling I was getting errors in \ActionBarSherlock\test\ complaining about Junit. I simply deleted the \Test\ directory from my ABS Module under project view. Right click \test\ > Delete...

5) you should now be able to compile without errors :)

Hopefully that helps someone.

Essentially though, I needed to re-download a completely fresh ABS, expunge my old project's ABS (which was probably quite old) then Import Module...

EDIT: This was written a while ago so I'm not sure how relevant it is today, but as Paulo mentions in the comments try these steps, and also have a read of the general import library to ABS thread over here --> How do I add a library project to Android Studio?

like image 126
wired00 Avatar answered Nov 14 '22 23:11

wired00


dependencies {
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.android.support:support-v4:13.0.+'
}

Found that from ActionBar Sherlock with Android Studio 0.2.2

This question should be closed and linked as dupe. The above line adds the lib as maven dependency and therefore doesn't need to be included as a whole project. It also lets you control the version from one line. Fantastic fix. Thank the OP on the other question for posting.

Here is a sample project on github as well:

https://github.com/JakeWharton/ActionBarSherlock-Gradle-Sample

The support library version number is not critical make sure you always use the most up to date version permitted by your project. The actual inclusion of the support jar as a whole is NOT optional

like image 13
Dan Sabin Avatar answered Nov 14 '22 22:11

Dan Sabin


wired00's answer is good, but I had the following error during compilation :

android-apt-compiler: No resource found that matches the given name 'Theme.Sherlock.Light'

It happened that ActionBarSherlock was compiled as an application project. It was a bit hard to find the check box to compile it as a library, so in case you have the same problem, go to :

File > Project structure > Facets > ActionBarSherlock > Check "Library module".

like image 2
Dalmas Avatar answered Nov 15 '22 00:11

Dalmas