找不到与给定名称匹配的资源 AppCompat.Light.DarkActionBar

No resource found that matches the given name AppCompat.Light.DarkActionBar

我尝试了所有方法,但仍然出现错误

 <style name="AppTheme" parent="AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

在我的样式文件夹中,我尝试使用

编译'com.android.support:appcompat-v7:25.3.1'

甚至尝试在布局中将主题更改为 Apptheme 但无法呈现。我尝试了所有可能的步骤,甚至下载了 sdk 工具 19.1 和 20。我做错了什么?

编辑:我的应用程序 gradle 文件:

    apply plugin: 'com.android.application'

android {
    signingConfigs {
    }
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.examples.test"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 2
        versionName "1.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    productFlavors {

    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

您必须使用:

<style name="AppTheme1" parent="Theme.AppCompat.Light.DarkActionBar">

而不是使用:

<style name="AppTheme1" parent="AppCompat.Light.DarkActionBar">

**您的风格有些变化values/style。xml **

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowActionModeOverlay">true</item>
    <item name="actionModeBackground">@color/black</item>
    <item name="android:itemBackground">@color/colorAccent</item>
</style>

 <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

第二次更改创建新的 res 文件夹名称 values-21/style.xml

<resources>
<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

问题似乎出在 build.gradle 项目文件中(感谢 IntelliJ Amiya)

我更改了这个:

classpath 'com.android.tools.build:gradle:2.3.1'

classpath 'com.android.tools.build:gradle:2.2.2'

现在我在 AppCompat.Light.DarkActionBar

中没有发现任何错误