Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm following the android development tutorials from developers.android.com, and currently I'm trying to style my action bar using the information given here: https://developer.android.com/training/basics/actionbar/styling.html#CustomBackground7

Here's the code of res/values/themes.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@android:style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>

    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@drawable/actionbar_background</item>
        <!-- Support library compatibility -->
        <item name="background">@drawable/actionbar_background</item>

    </style>
</resources>

I see red cross icons beside the "style" opening tags, hovering on which the error message reads: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar'.

  • My application has minSdkVersion="11" and targetSdkVersion="21", I tried changing the minSdkVersion to 13, 14 but it made no difference
  • Someone suggested to check whether appcompat has been marked as library project or not, I checked it and the "isLibrary" option was checked in the appcompat properties window.
  • I also made sure that appcompat was added to my project as a library project.
  • removing "@android" from "@android:style" or removing the "@" doesn't work. However in the first style tag, when I remove "@android" then the red cross sign goes away, but that doesn't happen for the second style tag.

Please help. I've been at it since morning and I'm not getting anywhere.

like image 932
thereisnospoon Avatar asked Oct 18 '14 07:10

thereisnospoon


1 Answers

Try to delete android:, like this:

<style name="CustomActionBarTheme"
       parent="@style/Theme.AppCompat.Light.DarkActionBar">
like image 159
PavelGP Avatar answered Oct 11 '22 10:10

PavelGP