简体   繁体   中英

Xamarin.Droid causing build errors in Visual Studio 2015 when using Xamarin.Forms

Recently, I've started learning to develop mobile apps using Xamarin.Forms through a book. I created an application "Hello", which had six projects, one Portable Shared Library project, one Android, one iOS and three Windows (two for Windows 8 and Windows 8 Phone and one for Windows 10 UWP). I was getting NuGet package updates, and my problems started from there.

First problem:

The updates were mainly of the Android Support Libraries, but one was of Xamarin.Forms. All of them got updated except for this one. All of my Android Support Library packages are updated to v23.2.1. I got the following error while trying to update Xamarin.Forms:

尝试更新Xamarin.Forms时出错

So I decided not to update, and then went on to build the project (the only modification I made was in App.cs, changing XAlign to HorizontalTextAlign because I got a warning in the error list to do that, rest all the code was present already as it is) and here comes my second problem :

I got 119 errors from Hello.Droid and 2 warnings from Hello.iOS, 1 warning from Hello.WinPhone, 1 warning from Hello.Windows and 1 warning from Hello (Hello is my App name). Below are the screenshots:

构建后的错误

构建后的错误和警告

Errors not visible in the screenshots have the code CS0117 and have description starting with: "'Resource.Stylable' does not contain... etc."

I don't understand what is causing these errors and what is the solution for them. The only reason to post my question here is that I was not able to find a solution to my problem on the internet. I've searched a lot.

Help would be appreciated.

PS I've got to know that Xamarin experts are trying to help developers at this site, so I request them to try to help me too.

If any more information is needed, just tell me, I'll provide it.

Thanks in advance.

EDIT: These are the Android support packages: Android支持包

EDIT 2: Screenshot of the new errors: 重新安装后出错

This question continues here: Part 2

The initial errors you were getting are because Xamarin Forms only supports 23.0.1.3. With XF 2.2.0-pre1 they have updated to 23.1.1.1 but its still not the latest.

To remove these errors, I would uninstall all Google support packages and Xamarin Forms. Then just download Xamarin Forms and it will install the correct version.

The best option is to never to an Update All in Xamarin in the future.

Then after this is done the Resource.Designer.cs file might still cause some issues. As such, go to that file, delete everything inside of it and then rebuild the project again.

As for your licensing errors, make sure you update to the latest version of Xamarin.

  1. Go to Tools > Options
  2. Then go to Xamarin > Other
  3. Then press Update and go through the install.
  4. Then restart VS and you should have those licensing errors removed now that Xamarin is free with Visual Studio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM