Quinma
Quinma

Reputation: 1476

ActionBarSherlock Beginners Setup Error

I am attempting to set up ActionBarShelock for the first time using Eclipse on Windows 7.

I followed these instructions: http://actionbarsherlock.com/usage.html

ActionBarSherlock project.properties:

    android.library=true
    # Project target.
    target=android-15

ActionBarSherlock AndroidManifest.xml:

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="11"/>

My error in Lint: Call requires API level 11 (current min is 7): android.widget...

Or if I ignore the error on ActionBarSherlock and import it as a library then I cannot compile my project because any references to the library are not recognized and I get no resource errors.

I looked up many people with similar problems and it was always an API build target error. Thank you for your suggestions!

Upvotes: 3

Views: 3653

Answers (3)

Quinma
Quinma

Reputation: 1476

I found it! The JDK compliance level was set to 1.5. After setting it to 1.6 it worked.

It says this right in the Action Bar Sherlock website in the requirements section but I made the error of assuming Eclipse was using the latest JDK settings.

Definite beginners mistake.

Thank you for your help.

Upvotes: 3

Jake Wharton
Jake Wharton

Reputation: 76115

A few things:

  1. Make sure you are compiling your application with Android 4.0 or newer (API 14+). You must do this in addition to just the library.
  2. Ensure you are calling getSupportActionBar rather than getActionBar. This is likely the source of your errors for lint.
  3. While targeting API 11 is valid, many things are gained by targeting 14 or higher. Try to do that if you can.

Upvotes: 3

Mattias Isegran Bergander
Mattias Isegran Bergander

Reputation: 11909

Are you using an old version of ActionBarSherlock perhaps? As the current version, 4.1.0 has the targetSdk set to 15.

I think some older version can have a problem with newer ADT/lint or similar.

Upvotes: 1

Related Questions