Hundreds of Resource.Designer.cs build errors on latest Xamarin Forms 2.2.0.45

Deadly 提交于 2019-12-31 03:33:19

问题


I have a new Xamarin Forms solution setup with a PCL, an iOS app (which builds fine), and an Android project. The Android project is up to date with the latest Nuget packages for Xamarin Forms (2.2.0.45) to match the PCL project. However when I build the project I'm getting over 500 errors in the Resource.Designer.cs file.

I've tried all the suggestions that I've found online, such as deleting the file and having it regenerated during the Build. Checking the .csproj file for the tag and it's there.

Xamarin Forums don't have any answers, some people have filed bug reports. I can't imagine having a clean new Android project on Xamarin Forms won't build. The PCL and iOS app are running fine and have no errors.

Example build output looks like this:

1>C:\MyApp\Droid\Resources\Resource.Designer.cs(39,124,39,130): error CS0117: 'Resource.Animation' does not contain a definition for 'fab_in' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(40,125,40,132): error CS0117: 'Resource.Animation' does not contain a definition for 'fab_out' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(41,129,41,140): error CS0117: 'Resource.Animation' does not contain a definition for 'snackbar_in' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(42,130,42,142): error CS0117: 'Resource.Animation' does not contain a definition for 'snackbar_out' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(87,125,87,132): error CS0117: 'Resource.Attribute' does not contain a definition for 'barSize' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(125,145,125,172): error CS0117: 'Resource.Attribute' does not contain a definition for 'disableChildrenWhenDisabled' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(192,136,192,154): error CS0117: 'Resource.Attribute' does not contain a definition for 'middleBarArrowSize' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(204,133,204,148): error CS0117: 'Resource.Attribute' does not contain a definition for 'popupPromptView' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(211,124,211,130): error CS0117: 'Resource.Attribute' does not contain a definition for 'prompt' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(228,129,228,140): error CS0117: 'Resource.Attribute' does not contain a definition for 'spinnerMode' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(282,139,282,160): error CS0117: 'Resource.Attribute' does not contain a definition for 'topBottomBarArrowSize' 1>C:\MyApp\Droid\Resources\Resource.Designer.cs(337,121,337,132): error CS0117: 'Resource.Color' does not contain a definition for 'error_color'


回答1:


Check your android sdk manager and uninstall all Android SDK Build Tools except for the lastest and greatest

Close Visual Studio and Delete Everything in this folder and C:\Users\YOURUSER\AppData\Local\Xamarin\

Reopen Project And Rebuild Solution and visual Studio will re-download files needed back in that folder and you should be set to go




回答2:


I solved this by installing these Nuget packages -Xamarin.Android.Support.Design, Xamarin.Android.Support.v13, Xamarin.Android.Support.v4, Xamarin.Android.Support.v7.AppCompat, Xamarin.Android.Support.v7.CardView, Xamarin.Android.Support.v7.GridLayout, Xamarin.Android.Support.v7.MediaRouter, Xamarin.Android.Support.v7.Palette, Xamarin.Android.Support.v7.RecyclerView, Xamarin.Android.Support.v8.RenderScript, Xamarin.Android.Support.Vector.Drawable, and also @Clowning answer of adding a partial class for the missing resources. CHECKED IN, NEVER TO TOUCH NUGET ON THIS PROJECT AGAIN!




回答3:


I've also had this problem very recently, Follow these steps =>

  • Clean your solution, build again then you will see these kind of errors in outpust " Please install package: 'Android Support Library' available in SDK installer. Java library file

    C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\embedded\classes.jar doesn't exist. MyProject.Droid"

    then please follow this question [Xamarin Forms Android Error: Please install package 'Android Support Library'

  • Please update your package but keep in mind that package version should depend on the version of Xamarin Forms you have installed.

  • At last if problem still persists with some strings then cross
    check the components updates and build tools version from the android sdk managers.

It was quite a long process and you have to hit/try for this with the correct packages installation.



来源:https://stackoverflow.com/questions/37815357/hundreds-of-resource-designer-cs-build-errors-on-latest-xamarin-forms-2-2-0-45

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!