Home » Android » No Resource found that matches the given name Xamarin Android

No Resource found that matches the given name Xamarin Android

Posted by: admin June 15, 2020 Leave a comment


I always get the error “No Resource found that matches the given name” in my themes.xml file no matter which resource I use or in which I use it. Even if the resource works everywhere else.

Here’s some code:

    <?xml version="1.0" encoding="utf-8"?>
    <!-- the theme applied to the application or activity -->
    <style name="Theme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/ActionBarStyle</item>
        <item name="android:actionOverflowButtonStyle">@style/ActionBarOverflowStyle</item>

    <!-- ActionBar styles -->
    <style name="ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">#008A3D</item>

    <style name="ActionBarOverflowStyle" parent="@android:style/Widget.Holo.ActionButton.Overflow">
        <item name="android:src">@drawable/OverflowIcon</item>

    <!--Dialog styles-->
    <style name="DialogStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">#008A3D</item>

I deleted the item node to check whether I can use the resource in code.
Proof that it worked; No error:

How to&Answers:

After googling and fiddling around for a few more hours I figured out that the problem was due to the fact that I use uppercase characters in the file name which works fine everywhere else. This is either a terrible behavior of Android or a bug in Xamarin.


For anyone else that finds this question for different reasons:

Whenever I Copy or Rename a drawable resource in VS 2017, it changes the ‘Build Action’.

Double check your resources, and ensure the Build Action is set correctly. In my case, it needed to be ‘AndroidResource’


Remove the image from the project, clean the project, add the properly renamed image(don’t try to rename the image once you have added to the project). Should work perfectly.