4

Because it takes me a lot of time to integrate the Sherlock Action Bar in my Android project (with its map plugin !), I propose to depict here my solution.

AntoineP
  • 3,035
  • 1
  • 19
  • 22

1 Answers1

6

First step consists to create a library project, second to create your own project that will use the Action Bar and third step enables to use the map plugin.

I - ActionBar SHerlock project :

  1. download the actionbarSherlock zip file
  2. import existing Android code into Workspace (for ActionBar 4.2.0). select the directory "library" to import. A "library" project is created.
  3. set your manifest with "android:minSdkVersion="7" android:targetSdkVersion="16"
  4. Import compatibility library: right click on the project > Android Tools > Add Support Library
  5. configure this project with the following Project properties :

    • android build target : >= android 4.0
    • check "Is Library"

II - Your project :

  1. create your project that use Action Bar sherlock
  2. set Android Build Target to >= Android 4.0 (choose the same target than the previous project !)
  3. set your manifest with "android:minSdkVersion="7" android:targetSdkVersion="16"
  4. add the previous project "ActionBarSherlock" as a library : Project > Properties > Android > Add... (bottom panel)
  5. Change your code to use the ActionBar classes

III - To use the actionbarsherlock-plugin-maps-4.1.0.jar plugin of Action Bar Sherlock :

  1. add the actionbarsherlock-plugin-maps-4.1.0.jar (obtained from the zip file) to the project "ActionBarSherlock" in the libs directory
  2. configure the project : project > properties > build path > Librairies :

    - add actionbarsherlock-plugin-maps-4.1.0.jar
    
  3. set the build target to Google map API >4.0 (do the same for your project - same target !)

  4. add the "actionbarsherlock-plugin-maps-4.1.0.jar" library to the new project’s build path

I Hope it will also work for you.

AntoineP
  • 3,035
  • 1
  • 19
  • 22
  • How should I remove the `android-support-v4.jar` from the build path? It is only listed as an item in `Android Dependencies`. I cannot remove the actual file from the `libs` folder since there are dependencies.. - When I setup an example project as you described I always end up with a `ClassNotFoundException` when I run the app. – JJD Jul 18 '12 at 15:22
  • also you need java set to 1.6 when compiling and change the compiler's option from Eclipse->preferences-> "Potential null pointer access" to Warning instead of Error – max4ever Jul 30 '12 at 13:57
  • I don't see that actionbarsherlock-plugin-maps-4.1.0.jar file in the zip file that I downloaded? – Alan Moore Oct 02 '12 at 01:35
  • This plugin is not included by default : http://actionbarsherlock.com/download.html – AntoineP Oct 24 '12 at 16:13