Search code examples
androideclipseactionbarsherlock

Adding ActionBarSherlock in Eclipse Juno


I´m new to Android World but I really like it, I programmed some apps and now I would like to try the ActionBarSherlock specially for the tabs menu.

I have Eclipse Juno version 4.2, I use jdk-7u5 and the latest version of SDK (v.20)

I want to install ActionBarSherlock version 4.1

As in Eclipse Juno there is no "Select Create project from existing source" option I imported Sherlock library as a existing project on Eclipse and a red cross appears in almost all packages in src.

Then, I added it as library on my own project. Now a red exclamation mark appears on my Android Aplication Project.

I´m using android:minSdkVersion="7" android:targetSdkVersion="14"

I read a lot about different problems with the library ActionBarSherlock and I tried everything they say in the forum, even install Eclipse Helios to use the option "Select Create project from existing source", but I had an Installation Problem with ADT.

Thank you in advance everybody.


Solution

  • From this web http://www.grokkingandroid.com/adding-actionbarsherlock-to-your-project/

    Getting ActionBarSherlock and adding it to Eclipse

    The first thing you have to do, is to download the library from actionbarsherlock.com. After this unzip/untar it. The download contains three folders: library, samples and website. The samples folder contains four sample projects to showcase what you can do and to show you how to do it. You should have a look at them. The website folder contains the code of the project website. The library folder finally contains ActionBarSherlock’s source code. Now go to Eclipse and add the ABS-library as an Android project. Do not use Eclipse’s import tool to import the ActionBarSherlock library – it would not work immediately and you would have to fix some settings. Instead use the project creation wizard of the Android Developer Tools.

    Open File -> New -> Project -> Android Project From Existing Code.

    Creating an Android project from existing source In the next screen select the folder, which Eclipse then uses to search for projects. If you select the ActionBarSherlock root folder, Eclipse suggests a list of projects to create. Leave the “library” project checked and uncheck all others:

    Select the library project Click “Finish” to create the project.

    Eclipse will now create a new project named “library”. I prefer a more useful name, so select the project called “library” and hit F2 to rename the project. I have renamed the project in Eclipse to “ActionBarSherlock”, so all following screens will refer to this name.

    Adding the library to your project

    Now that ABS is a library project you have to tell your own project to use it. I will use the project of my last post for this. Go to FragmentStarter’s project settings and switch to the Android tab.

    If necessary scroll down until you see the Library panel. Click “Add”:

    Adding libraries to an Android project In the next window all available library projects will be listed. Select ActionBarSherlock and click “Ok”.

    Select ActionBarSherlock from the list of libraries When the window disappears the library should be listed in the library panel of the Android properties tab:

    Check if the library has been added succesfully

    Then appears an error: Jar mismatch! fix your dependencies, to solve it there is to copy the file android-support-v4.jar from your_project/libs and paste it on library/libs.

    Before you can use ActionBarSherlock you have to extends your Activity like this: public class MainActivity extends SherlockActivity and change the theme in Manifest: android:theme="@style/Theme.Sherlock.Light.DarkActionBar"

    This is the way to add ABS to your project. Hope it works for all