Can't Find Theme.AppCompat.Light for New Android ActionBar Support

Solution 1:

You need to do next:

  1. File->Import (android-sdk\extras\android\support\v7). Choose "AppCompat"
  2. Project-> properties->Android. In the section library "Add" and choose "AppCompat"
  3. That is all!

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

Solution 2:

If, like me, you are following the Android tutorial on http://developer.android.com/training/basics/actionbar/setting-up.html and keep getting this error, try to change the AppBaseTheme style in all styles.xml files. In detail:

  1. In file res/values/styles.xml change the line:

    <style name="AppBaseTheme" parent="android:Theme.Light">
    

    to:

    <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
    
  2. In file res/values-v11/styles.xml change the line:

    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
    

    to:

    <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
    
  3. In file res/values-v14/styles.xml change the line:

    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    

    to:

    <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    

Now the application should run fine.

Solution 3:

This is an issue that can happen in Android Studio if you modify Project Structure Modules. In this case you may need to add the dependencies again. In a text editor edit the 'build.gradle' file to include the required dependencies:

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

This should update your '{your_project_name}.iml' file with lib components:

<orderEntry type="library" exported="" name="appcompat-v7-19.0.1" level="project" />

Solution 4:

I will share my experience with this problem. I was going crazy because of this, but I found out that the problem was a bug with Eclipse itself, rather than my code: In eclipse, unable to reference an android library project in another android project

So, if you have the Android Support Library in your C: drive and your project in the D: drive on your computer, Eclipse won't function correctly and won't know where the Android Support Library is (green tick turns into red cross). To solve this, you need to move both projects onto the same hard drive.