7

today I updated the NuGet packages for our Android version (we are currently developing for Android and iOS). After the updates I cannot build the Android version anymore. This is an issue I faced everytime after updating packes so far, but this time I can't solve this problem. Usually restarting Xamarin or Reinstalling the NuGet packages helped.

I have 151 error messages like this one:

/Users/Username/Projects/MyAppName/Droid/Resources/Resource.designer.cs(118,118): Error CS0117: >MyAppName.Droid.Resource.Attribute' does not contain a definition for mediaRouteSettingsDrawable' (CS0117) (MyAppName.Droid)

Here are all the steps I already did trying to fix this problem (in this order):

  1. Build --> Clean all
  2. Uninstall every NuGet package from every project (Droid, iOS, SyncLibrary (own library for SQL server communication) and UITest)
  3. Delete everything inside of file "Resource.Designer.cs"
  4. Close Xamarin
  5. Install every package in the SDK Manager for every version
  6. Delete the packages folder of the solution
  7. Delete content of /Users/Username/.local/share/Xamarin
  8. Delete content of /Users/Username/.local/share/NuGet/cache
  9. Start Xamarin
  10. Add Newtonsoft.Json package to SyncLibrary
  11. Add Android packages: only add the needed packages, let NuGet resolve dependencies (like Xamarin.Android.Support, Xamarin.GooglePlayServices etc.) on its own. Installed packages (in this order):

    Xamarin.Forms.......................................(2.2.0.45)
    Xamarin.Forms.Maps...........................(2.2.0.45)
    XLabs.Forms............................................(2.0.5782)
    ZXing.Net.Mobile..................................(2.0.4.46)
    Newtonsoft.Json....................................(8.0.3)
    Xam.Plugin.Geolocator........................(3.0.4)

  12. Build --> Clean all

  13. Restart Xamarin
  14. Build new: SyncLibrary (so there's no dependency error when trying to build the Android version)
  15. Build new: Android version --> Error

I really don't know what to do anymore. Any help / ideas are appreciated, thanks in advance.

Mikalai Daronin
  • 8,590
  • 2
  • 35
  • 47
Tobe
  • 198
  • 2
  • 13
  • Could you make a right click on the resource file under which is the Resource.Designer.cs and click on `Run custom tool` ? – Irwene Jun 09 '16 at 07:30
  • I'm not completely sure what file you mean. This is what I see when i rightclick on the Resource.Designer.cs:
    ![Image](http://imgur.com/BeAiXzK)
    – Tobe Jun 09 '16 at 08:11
  • Translation of the image: Open with… Version Control Reveal in Finder Copy Cut Delete Rename Build Actions Quick Properties Refresh – Tobe Jun 09 '16 at 08:17
  • My bad, I thought you were using Visual Studio with Xamarin Tools.... What happens in your case is that the file is not regenerated while the definitions of the ressources were. This seems to be a known Xamaein Issue usng Xamaein studio check their KB : https://kb.xamarin.com/customer/portal/articles/1638018-my-android-resource-designer-cs-file-will-not-update – Irwene Jun 09 '16 at 08:51
  • Sorry, forgot to mention I'm on a Mac. The .csproj file contains the line Resources\Resource.designer.cs and when I delete the content of Resource.designer.cs rebuilding the Android version adds the content back to it. – Tobe Jun 09 '16 at 09:07
  • If the error is not due to a bug, it might be because you forgot to save a resource you added. Try to add this resource `mediaRouteSettingsDrawable` again then recompile (sorry if this sounds dumb, but it's the last idea I got) – Irwene Jun 09 '16 at 09:23
  • That resource is definitely from Android itself. I get that error for 151 resources, no way I forgot to add 151 resources :-) I'm still comparing the .csproj file with one from a newly created project. So far everything seems fine with it. Many thanks for your help so far! – Tobe Jun 09 '16 at 09:26
  • Don't forget to post an answer if you find out what happened :) – Irwene Jun 09 '16 at 09:29

3 Answers3

4

Xamarin.Forms...(2.2.0.45)

XLabs.Forms.....(2.0.5782)

That's the point. The last stable Xamarin.Forms has some problems that may cause build errors when you're using XLabs or another library.

The only solution which I know is to use pre-release version of XLabs.Forms - 2.2.0-pre02.

In my case I updated XLabs packages and cleared/rebuild my solutions.

More info in XLabs issue tracker and Xamarin Bugzilla.

Community
  • 1
  • 1
Mikalai Daronin
  • 8,590
  • 2
  • 35
  • 47
0

I've experienced similar errors, but didn't use XLabs.Forms. I saw, that you used ZXing.Net.Mobile also, as me - I've updated that to newest pre-release (in the time of writing: 2.1.0-beta1) and it also helpep.

dodocs
  • 61
  • 6
0

I have the same problem with mine Xamarin solution

have you tried:

  • Exit Visual Studio
  • Deleting c:\Users\username\AppData\Local\Xamarin
  • Open the solution again
  • Compile, wait until it finishes completely.

Anyway, found this link, maybe it was useful: Xamarin: Build action EmbeddedResource

Daniel Kaas
  • 111
  • 8