Mysterious_android
Mysterious_android

Reputation: 618

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

I tried everything but I am still getting errors in

 <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>

and

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

In my styles folder, I tried using

compile 'com.android.support:appcompat-v7:25.3.1'

and even tried changing the theme to Apptheme in layout but unable to render. I tried every step possible with even downloading sdk tools 19.1 and 20. What am I doing wrong?

EDIT: My app gradle file:

    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'
}

Upvotes: 0

Views: 1550

Answers (3)

Mysterious_android
Mysterious_android

Reputation: 618

The problem seems to be in the build.gradle project file (thanks IntelliJ Amiya)

I changed this:

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

To

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

And now I don't get any erros in AppCompat.Light.DarkActionBar

Upvotes: 1

Ratilal Chopda
Ratilal Chopda

Reputation: 4220

**Some Changes in your style 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" />

second change create new res folder name 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>

Upvotes: 1

qenndrimm
qenndrimm

Reputation: 11

You have to use:

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

Instead of using:

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

Upvotes: 0

Related Questions