0
votes

I want to have actionbar in my Android Project using android.support.v7.appcompat; and use it in android 2.2 API Version 8.

I Installed Android support library from SDK Manager, and also added the android-support-v7-appcompat from /extras/android/Compatibility/v7/

but the current version of this project is 4.2 (the last version of SDK I have already downloaded). When I add this project as a reference to my project I get error (my resurce file (R) has error and couldn't use R.layout.main)

how can I solve my Problem and use support.v7 ActionBar?

1
"When I add this project as a reference to my project I get error (my resurce file (R) has error and couldn't use R.layout.main)" -- what is the error? - CommonsWare
the Error Text is : "R cannot be resolved to a variable" - mohammad jannesary
Sorry, I misunderstood. You should have errors associated with one or more of your resources, or perhaps the manifest, which is preventing R from being generated. - CommonsWare
I don't think so; I just Created a project; without any extra code; if I remove the Support-Project from Library; Every things go well; - mohammad jannesary
as I wrote; the support-project is Android 4.2 and my Project is Android 2.2; if Change it to Android 4.2; I don't have problem; how can use Support-Library project in Android 2.2? - mohammad jannesary

1 Answers

1
votes

if Change it to Android 4.2; I don't have problem

You are forcing us to have to guess what "it" is.

If "it" is your build target (e.g., Project > Properties > Android in Eclipse), please set that to something like 4.2. This does not control what versions of Android your app runs on. Set your android:minSdkVersion to be 8 (for Android 2.2), as that is what controls what versions of Android your app runs on. Lint will tell you when you are using things that are legal for your build target, but newer than your android:minSdkVersion, so you can make sure that you are using those things appropriately.