ERROR: No resource found that matches the given name: attr 'colorAccent'

1

I created a project from scratch and when I was compiling it is giving this error. I have already updated the Android SDK and still the error continues. This is giving on all Style.xml nodes . What is going on? It's the first compile. My Style

<?xml version="1.0" encoding="utf-8" ?>
<resources>

  <style name="MainTheme" parent="MainTheme.Base">
  </style>
  <!-- Base theme applied no matter what API -->
  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
    <item name="windowNoTitle">true</item>
    <!--We will be using the toolbar so no need to show ActionBar-->
    <item name="windowActionBar">false</item>
    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#2196F3</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">#1976D2</item>
    <!-- colorAccent is used as the default value for colorControlActivated
         which is used to tint widgets -->
    <item name="colorAccent">#FF4081</item>
    <!-- You can also set colorControlNormal, colorControlActivated
         colorControlHighlight and colorSwitchThumbNormal. -->
    <item name="windowActionModeOverlay">true</item>

    <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
  </style>

  <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">#FF4081</item>
  </style>
</resources>
    
asked by anonymous 25.09.2017 / 18:24

3 answers

1

Add in styles:

No res/values-v21/styles.xml

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <style name="AppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
    <item name="android:colorPrimary">@color/primaryColor</item>
    </style>
</resources>

And no res/values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/primaryColor</item>
    </style>
</resources>
    
25.09.2017 / 18:27
1

This error is related to the Xamarin AppCompat package, check if the reference is correct and if it is correct delete the "/ obj" folder that is at the root of the project.

    
28.09.2017 / 20:11
0

As suggested by AbdiRahman

, I solved this problem by deleting all the contents of the C: \ Users \ USUARIO \ AppData \ Local \ Xamarin folder and then cleaning and recompiling the solution again in Visual Studio.     
29.08.2018 / 20:07