Thursday, 15 October 2020

Xamarin Android CS0117 "Resource.Drawable does not contain a definition for XXX" during compile

When building a hybrid Xamarin Android app, we have a bizarre, intermittent issue.

The app is quite large and split into several components.

  • App1
    • App1.Android
    • App1.iOS
  • App2
    • App2.Android
    • App2.iOS
  • Shared.Core
  • Shared.Android
  • Shared.iOS

App1.Android and App2.Android share Shared.Core and Shared.Android, App1.iOS and App2.iOS shared Shared.Core and Shared.iOS. It's Shared.Android (an Xamarin Android library) which is vexing me.

When attempting to compile, sometimes the build fails because it says that Resources.Drawable doesn't contain a reference to two specific items. These are seek.xml and seek_style.xml.

However IntelliSense sees the expected value and if I look into Resource.designer.cs the values are there and when F12ing to the source the two entities are listed.

The two files are in the Resource/drawable folder and as mentioned before can be F12ed to during normal IntelliSense operations.

I've tried several guides to resolve this issue, including the one here: https://stackoverflow.com/a/36759115 but they only seem to provide temporary relief.

Does anyone have any suggestions? I'm tearing my hair out here.

Some screenshots:

  1. File with reference (and working IntelliSense): Base File
  2. Content of Resources.Drawable: Resources.Drawable
  3. Compile time errors: Compile time errors
  4. Files in Drawable folder (with properties): seek.xml properties seek_style.xml properties


from Xamarin Android CS0117 "Resource.Drawable does not contain a definition for XXX" during compile

No comments:

Post a Comment