I am trying to use Jake Wharton's ActionBarSherlock to support actionbars in android projects all the way down to 1.6
I'm getting started using the video provided on the faq's page but after 2:25 in the video, when he imports the project, I get a whole huge list of >200 compilers errors, mostly dealing with some @override stuff. I fix most of those errors by:
Right click on the project>properties>Java Compiler>compiler compliance level: and I set it to 1.6.
This forces a re-build and suddenly I am down to just 54 errors. Most of them are "R cannot be resolved to a variable" but the last 5 are all "the import com.actionbarsherlock.R cannot be resolved". I have searched around and the common ways of solving this worked out as follows:
"Make sure your resources are not in error" -- I checked and there are no problems with anything in the /res folder
"Make sure you aren't importing android.R" -- I am not. I have:
import com.actionbarsherlock.R
It occurred to me that the package name might be incorrect, but it isn't.
"Simply clean the project" -- Have done this many times to no effect
"Make sure eclipse is able to generate R files at all" -- It can in the blank test project I made just now
And some other fixes which are more specific to ActionBarSherlock:
"Make sure your targetSDK is 11 or higher" -- It is set to 13
"Make sure the project is a library project" -- It is
How can I get rid of these errors?
Found it!
Instead of:
Project > Clean > Clean Projects Selected Below
you must use
Project > Clean > Clean All Projects
Even if none of the other projects have anything to do with the library project. This fixed the problem
My fault was, that the ABS-project and my project had different API levels. ABS was on level 4.0.3 and my project had 3.0. After changing the API level of my project to 4.0.3 all errors were fixed. This post helped me to find the solution.
Might also need to make sure your nen/R.java file is created for the right package name:
On AndroidManifest.xml, make sure the manifest tag, package attribute is set to:
"com.actionbarsherlock"
Instead of importing the single folder actionbarsherlock, I ended up picking the parent folder and unchecked everything but actionbarsherlock in the Import Projects window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With