Error while building for Android (No resource found that matches the given name...)

Hi. I just installed Xamarin Studio on my mac. When trying to build a new project for xamarin forms on android I get the following errors:

   /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: No resource found that matches the given name: attr 'colorAccent'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: No resource found that matches the given name: attr 'colorPrimary'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: No resource found that matches the given name: attr 'colorPrimaryDark'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: No resource found that matches the given name: attr 'windowActionBar'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: No resource found that matches the given name: attr 'windowActionModeOverlay'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: No resource found that matches the given name: attr 'windowNoTitle'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. (APT0000) (AdoptMeTest.Droid)

    /Users/mariano/Projects/AdoptMeTest/Droid/Resources/values/styles.xml(0,0): Error APT0000: No resource found that matches the given name: attr 'colorAccent'. (APT0000) (AdoptMeTest.Droid)

Any ideas what may be going on?
Thanks.

Answers

  • Patil2421Patil2421 USMember ✭✭✭

    @MarianoAndres
    The error is you have styles.xml in your Resources folder and the it's not able to find the values against the attributes defined. You must have deleted something by mistake.
    Replace all your code in styles.xml with the code in attached file.

    And do this change in MainActivity.cs file replace the defined theme name with this:
    Theme = "@style/MyTheme"
    Hope this helps.

  • I got this error when I changed the name (and namespace) of my Xamarin.Android project outside of Visual Studio.

    I just manually deleted the (Droid)\Resources\Resources.Designer.cs file, reopened it in VS 2017 and rebuilt it. It regenerates that file if your resources change (or if it can't find it), and that fixed it for me. Annoying tho, took me ages to figure it out!

  • Sir @JohnWilson.4976 . I did the steps you specified, but the file Resources.Designer.cs was not regenerated.

Sign In or Register to comment.