I am trying to implement the new ActionBar support library that was released by Google a couple days ago. In the past, I have successfully implemented ActionBarSherlock wit
For IntelliJ IDEA or Android Studio:
Add this to app.gradle build file
dependencies {
compile "com.android.support:appcompat-v7:21.0.+"
}
Replace -v:xx.0+
, with your build target, if you have 19 platform
then it must be like:
dependencies {
compile "com.android.support:appcompat-v7:19.0.+"
}
For Android Studio 1.2.2
Drop "android" from the parent
attribute value:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"></style>
You need to do next:
File->Import (android-sdk\extras\android\support\v7)
. Choose "AppCompat" Project-> properties->Android.
In the section library "Add" and choose "AppCompat" Note: if you are using "android:showAsAction" in menu item, you need to change prefix android as in the example http://developer.android.com/guide/topics/ui/actionbar.html
I had the same issue and even after importing/adding a jar/library as mentioned in the answers it would not solve the error. Out of frustration, I just created a new workspace and created a fresh android project and it automatically imported appcompat_v7 and there were no errors on clean and build. Didn't have to import a single jar/ library manually. Just FYI I am using eclipse Mars.1 Release (4.5.1) and was facing the exact same issue everytime I created a new android project.
Since the Import dialouge is different in Android Studio 1.0.1, I could't get Svyatoslav Lobachs version to work.
Instead I downloaded "Android Support Repository" in the SDK Manager. Then added
dependencies {
...
compile "com.android.support:appcompat-v7:18.0.+"
}
to build.gradle
. Worked for me.
Quickest solution :
right click on the project - > Android tools -> Add support library..