Android sample ActionBarCompat

Go To StackoverFlow.com

1

I guess that I am missing something here.

After having found this sample within the reference docs, I wanted to test it out. So, I created a new project by importing this one - targeting v2.3 of the SDK.

However, when the project opens, there are 51 errors.

My question, even though this is supposed to run in versions prior to android 3.0, what version of the SDK should I building it with ?

2012-04-05 15:23
by Simon


2

Set the target API level to 14 (4.0) but the minimum level (in the manifest) to 3 or higher.

Then it should works.

2012-04-05 15:31
by Jokahero
Tried that, it still complains about "android:style/Theme.Holo.Light", "android:actionBarStyle", etc... In adition, this sample is there to demonstrate a compatible ActionBar which works in api before v2.3 - Simon 2012-04-05 15:35
It's weird it works perfectly for m - Jokahero 2012-04-05 15:43
Ok, heres what I had to do. 1. put the target api level to 14, as you said. 2. CLEAN the project <- step important. 3. Adjust the AndroidManifest.xml file to point to min sdk 2.3. 4. Three methods were declared as Override, needed to comment out the Override. Then it worked - Simon 2012-04-05 16:08
One last thing (slightly off topic but I hope you can shed some light). I thought that when we did a "Create project from existing source" that it was supposed to copy the contents into a new file structure leaving the original alone. Eclipse is not doing this, do you know what I need to change for it to work correctly - Simon 2012-04-05 16:11
For this behavior use Import -> Existing project into workspace and check "Copy projets into workspace" I think it will do what you're looking fo - Jokahero 2012-04-05 20:36


1

I had similar errors which were fixed with what SIMON says PLUS:

Problem with xxxxx cannot be resolved or is not a field which could be found under R.java Solved it by removing the import android.R; at the top of MainActivity.java

2012-06-20 01:35
by Platz


1

If you still have problems with errors, this is how I fixed it...

Right-click on "com.example.android.actionbarcompat.MainActivity" under package explorer pane. Click properties(Last option at the button) from here change the build target under Android Properties. select the api 14 android 4.0

I have tried the manifest way and it didn't work but this worked for me. :D

2012-11-04 10:36
by Sybregunne
Ads