ERROR: No Resource found that Matches the Given name: attr 'colorAccent'

Asked

Viewed 1,344 times

2

I created a project from scratch and when I went to compile it is giving this error. I already updated the Android SDK and still the error continues. It’s giving in all the nodes of Style.xml. What’s 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>

3 answers

1

As suggested by Abdirahman, I solved this problem by deleting the entire contents of the folder C: Users USUARIO Appdata Local Xamarin and then cleaning and recompiling the solution again in Visual Studio.

1

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

1

Add to the Tyles:

In the 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 in the 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>
  • Matheus, these are the references. When I started the project was ok, but when I installed the Plugin.Firebasepushnotification reference, zoomed everything and I didn’t even notice, because everything was ok. I’ll reinstall the refe and test again.

  • Try to vote for the default settings as I posted up here in case you don’t try to update the project’s app-compat

  • Matheus, where do I add this? I don’t understand. The problem has returned and I have no way to update.

  • I put the paths on top of the codes

  • It’s not working that way. I don’t know what happened.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.