问题
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):
- Build --> Clean all
- Uninstall every NuGet package from every project (Droid, iOS, SyncLibrary (own library for SQL server communication) and UITest)
- Delete everything inside of file "Resource.Designer.cs"
- Close Xamarin
- Install every package in the SDK Manager for every version
- Delete the packages folder of the solution
- Delete content of /Users/Username/.local/share/Xamarin
- Delete content of /Users/Username/.local/share/NuGet/cache
- Start Xamarin
- Add Newtonsoft.Json package to SyncLibrary
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)Build --> Clean all
- Restart Xamarin
- Build new: SyncLibrary (so there's no dependency error when trying to build the Android version)
- Build new: Android version --> Error
I really don't know what to do anymore. Any help / ideas are appreciated, thanks in advance.
回答1:
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.
回答2:
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.
回答3:
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
来源:https://stackoverflow.com/questions/37719429/resource-designer-cs-resource-does-not-contain-a-definition-for