ActionBarSherlock gives tons of "Call requires API level 11 (current min is 7)" errors

vurp0 picture vurp0 · Apr 21, 2012 · Viewed 25.1k times · Source

I downloaded ActionBarSherlock 4.0.3, unzipped it and created a new project from the library folder. The src folder was, according to Eclipse, full of errors, so I followed various instructions online, like adding android-support-v4.jar, setting target API to 15 and compiler compliance level to 1.6. Still, the project has 194 errors, all of which are "Call requires API level 11 (current min is 7)". So when I look at one of the errors, I see this:

@Override
public void invalidateOptionsMenu() {
    getSherlock().dispatchInvalidateOptionsMenu();
}

public void supportInvalidateOptionsMenu() {
    invalidateOptionsMenu();
    //the previous line has this error in Eclipse:
    //Call requires API level 11 (current min is 7): android.app.Activity#invalidateOptionsMenu
}

This looks strange to me, because invalidateOptionsMenu() is overridden with the previous function, but Eclipse still complains about the function requiring a newer API level. When I look at the other errors, I find that this is the case with many other errors too.

I have much more experience with Python than Java, so I don't understand anything of what causes this to happen. Help would be appreciated, and if you do help, could you also explain what causes this and what you did to solve it? I wouldn't want to ask someone every time I have a problem, I want to learn too.

Answer

Martin Nuc picture Martin Nuc · Apr 23, 2012

Happened to me after running Lint checks. Try right click on sherlock action bar project -> Android tools -> Clear Lint Markers.