No resource found - Theme.AppCompat.Light.DarkActi

2019-01-02 18:04发布

I used ActionBar Style Generator, and now trying to use into my app, but getting :

error: Error retrieving parent for item: No resource found that matches the given name '@style/ Theme.AppCompat.Light.DarkActionBar'.

i am using android-support-v7-appcompat.jar lib inside libs folder

my target is to make my app compatible 2.3 or above

13条回答
梦该遗忘
2楼-- · 2019-01-02 18:30

If you're using Eclipse, then add the reference library into your project as the following steps:

  1. Right-click your project in the Project Explorer View.
  2. Click Properties.
  3. Click Android in the Properties window.
  4. In the Library group, click Add...
    • See the image below.
  5. Select the library. Click OK.
  6. Click the OK button again in the Properties window.

The "Add" button in the project Properties window, Android section, Library group.

查看更多
倾城一夜雪
3楼-- · 2019-01-02 18:32

If you are using Eclipse just copying android-support-v7-appcompat.jar to libs folder will not work if you are going to use resources.

Follow steps from here for "Adding libraries with resources".

查看更多
宁负流年不负卿
4楼-- · 2019-01-02 18:32

In Eclipse: When importing a support library as a project library following the instructions at Adding Support Libraries, don't forget to check the option "Copy proyects into workspace"!

查看更多
浅入江南
5楼-- · 2019-01-02 18:33

A simple solution - replace contents this file (/res/values/styles.xml) to this is text:

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <!-- Customize your theme here. -->
</style>

查看更多
骚的不知所云
6楼-- · 2019-01-02 18:33

make sure there is a v7 directory in your sdk, I thought having the 'Android Support Library' (in Extras) was sufficient. Turns out I was missing the 'Local Maven repository for Support Libraries (extras;android;m2repository)' Studio found that actually and fixed the gradle dependencies. using gradle to build then worked. $ cat app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "pat.example.com.gdbdemo"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.2.1'
}
查看更多
梦该遗忘
7楼-- · 2019-01-02 18:38

AppCompat is a library project. You need to reference the library project in your android project.

Check the topic Adding libraries with resources.

查看更多
登录 后发表回答