Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Resource found that matches the given name Xamarin Android

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"?>
<resources>
    <!-- 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>
    </style>

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

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


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

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

like image 434
k0bin Avatar asked Jul 23 '14 18:07

k0bin


2 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.

like image 190
k0bin Avatar answered Oct 14 '22 04:10

k0bin


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'

like image 41
2b77bee6-5445-4c77-b1eb-4df3e5 Avatar answered Oct 14 '22 03:10

2b77bee6-5445-4c77-b1eb-4df3e5