Search code examples
androidactionbarsherlock

ActionBarSherlock Sample Demos code not compiling


I can't compile the ActionBarSherlock Sample Demos code

I have imported the SampleList Project in to ADT (Build: v21.1.0-569685)

But I get lots of basic errors

Description Resource    Path    Location    Type
ActionBar cannot be resolved to a type  TabNavigation.java  /SampleList/src/com/actionbarsherlock/sample/demos  line 24 Java Problem
ActionBar cannot be resolved to a variable  FeatureToggles.java /SampleList/src/com/actionbarsherlock/sample/demos  line 141    Java Problem
ActionBar cannot be resolved to a variable  FeatureToggles.java /SampleList/src/com/actionbarsherlock/sample/demos  line 147    Java Problem

And also an error to the library location, I'm not sure why this is?

When I go to Properties -> Android -> the Library actionbarsherlock has a cross by it


Solution

  • OK, I found the answer to my own question really needed to ensure that

    1.) the Library Actionbarsherlock has been created in the workspace and delete a duplicate android-support-v4.jar in that project

    2.) Delete the original reference to the library Actionbarsherlock, in the samples project and re-add

    3.) Then add android-support-v4.jar to a new libs folder

    Detailed steps for this are:

    Import ‘JakeWharton-ActionBarSherlock-4.3.1-0/Actionbarsherlock’ as an android project

    Delete the Android Dependencies ‘android-support-v4.jar’ in the actionbarsherlock project. As this there is already a reference to this in samples project. Clean all projects

    In the project wanting to use Actionbarsherlock in this case the sample ‘actionbarsherlock-samples’ Go to Project Properties -> Android -> remove any broken references to the ‘actionbarsherlock’ library , then add the library project The library project ‘Actionbarsherlock ‘ still has errors in it then

    So, what I did to fix it, was:

    1. Right click on your project ("actionbarsherlock") in the navigation menu on the left.
    2. Click 'Properties'.
    3. Click 'Java Build Path' on the left hand navigation pane.
    4. Click 'Add External Jars' button on the right.
    5. Navigate to: "\android-sdks\extras\android\support\v4"
    6. Choose "android-support-v4.jar", then click 'Open', then click 'Ok'.
    7. Left Click on your Project ("actionbarsherlock")
    8. Click 'Project' at the top, then click 'Clean', then click 'Ok'.