FAQ or official answer to No resource...'Theme.AppCompat.Light.DarkActionBar'

Is there a documented answer to the error message "Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'?

This is a very poorly worded Android error that has been around for a long time and typically means a mismatch between targeted API version and installed SDK. There seem to be many people that have this problem who, like me, have confirmed that their Xamarin.Android.Support.v7 is up to date and/or matched to their targeted version and proper SDK is installed yet still get the error. Also, the responses elsewhere are flooded with clean/rebuild or uninstall/reinstall type of answers. What is the real issue and what is the real fix?


  • jezhjezh Member, Xamarin Team Xamurai
    edited February 2019

    It is necessary for us to know something about Android Theme.
    1. Hoho Theme
    After Android 4.0, Android Design is introduced to supported the design of Android, eg. Holo style in code.
    For example, Theme.Holo.Light、 Theme.Holo.Light.DarkActionBar is just the design style for Android 4.0.
    In order to support the previous version of Android 4.0, so the v7 package is Introduced, and the Theme.AppCompat.Light、Theme.AppCompat.Light.DarkActionBar is produced for this style.
    If the minimum supported version of your android app is Android 4.0 , it is unnecessary to think about v7.
    2. Material Design Theme
    Material Design is introduced in Android 5.0, this is another breakthrough in Android design.
    Corresponding program implementation is Theme.AppCompat.Light、Theme.AppCompat.Light.DarkActionBar etc., but this style can only be used in the Android 5.0 version of the mobile phone, if the previous Android 5.0 want the Material Design, we need to reference appcompat - v7 package too . At the same time, the introduce of Theme.AppCompat.Light、Theme.AppCompat.Light.DarkActionBar is to be compatible with previous Android version.

    Question Analysis

    A scenario as follows will raise this issue.
    An app use the theme of Theme.AppCompat .The code of styles.xml file in the folder of values is as follows

       <!-- Base application theme. -->
        <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>



    The solution is to add reference to android-support-v7-appcompat, in Xamarin Android, you can add Nuget Xamarin.Android.Support.v7.AppCompat just like follows:

    Of course, the Nuget Xamarin.Android.Support.Design includes the function of Xamarin.Android.Support.v7.AppCompat, you can use it instead. After that , you can try again.

    If you don't use the feature of appcompat-v7 , you can just modify the code like this

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


     public class MainActivity : AppCompatActivity


    public class MainActivity : Activity

    and remove other codes reference from appcompat-v7

Sign In or Register to comment.