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

后端 未结 30 1878
误落风尘
误落风尘 2020-11-22 09:22

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

相关标签:
30条回答
  • 2020-11-22 10:23

    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.

    0 讨论(0)
  • 2020-11-22 10:27

    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" />
    
    0 讨论(0)
  • 2020-11-22 10:27

    You had better make new project with any name , then use appcompat_v7 that program make new .

    Right Click Project-> properties->Android
    

    In the section library Add and choose library appcompat.

    0 讨论(0)
  • 2020-11-22 10:27

    Forget everything. Just use the appcompat library downloaded using the Android Studio. It has all the missing definitions. No matter whether you are using in Eclipse or not.

    0 讨论(0)
  • 2020-11-22 10:28

    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.

    0 讨论(0)
  • 2020-11-22 10:28

    I dont know how many of you noticed this. Support library "appcompat_v7" and your project should be in a same directory(I mean workspace directory). Dont clean your project until its error free else you will have tough time with R.java

    0 讨论(0)
提交回复
热议问题