简体   繁体   English

使用Xamarin.Forms时,Xamarin.Droid在Visual Studio 2015中导致生成错误

[英]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. 最近,我开始学习使用Xamarin.Forms开发移动应用程序。 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). 我创建了一个应用程序“Hello”,它有六个项目,一个Portable Shared Library项目,一个Android,一个iOS和三个Windows(两个用于Windows 8和Windows 8 Phone,一个用于Windows 10 UWP)。 I was getting NuGet package updates, and my problems started from there. 我正在获取NuGet包更新,我的问题从那里开始。

First problem: 第一个问题:

The updates were mainly of the Android Support Libraries, but one was of Xamarin.Forms. 更新主要是Android支持库,但其中一个是Xamarin.Forms。 All of them got updated except for this one. 所有这些都得到了更新,除了这个。 All of my Android Support Library packages are updated to v23.2.1. 我的所有Android支持库包都更新到v23.2.1。 I got the following error while trying to update Xamarin.Forms: 尝试更新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 : 所以我决定不更新,然后继续构建项目(我做的唯一修改是在App.cs中,将XAlign更改为HorizontalTextAlign因为我在错误列表中收到警告要执行此操作,所有代码都存在已经原样了)这是我的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). 我从Hello.Droid收到119个错误,Hello.iOS收到2个警告,Hello.WinPhone收到1个警告,Hello.Windows收到1个警告,Hello收到1个警告(Hello是我的App名称)。 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." 屏幕截图中不可见的错误具有代码CS0117并且具有以下开头的描述:“'Resource.Stylable'不包含......等等”

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. PS我已经知道Xamarin专家正试图帮助这个站点的开发人员,所以我请他们试着帮助我。

If any more information is needed, just tell me, I'll provide it. 如果需要更多信息,请告诉我,我会提供。

Thanks in advance. 提前致谢。

EDIT: These are the Android support packages: 编辑:这些是Android支持包: Android支持包

EDIT 2: Screenshot of the new errors: 编辑2:新错误的屏幕截图: 重新安装后出错

This question continues here: Part 2 这个问题在这里继续: 第2部分

The initial errors you were getting are because Xamarin Forms only supports 23.0.1.3. 您获得的初始错误是因为Xamarin Forms仅支持23.0.1.3。 With XF 2.2.0-pre1 they have updated to 23.1.1.1 but its still not the latest. 使用XF 2.2.0-pre1,它们已更新到23.1.1.1,但它仍然不是最新的。

To remove these errors, I would uninstall all Google support packages and Xamarin Forms. 要删除这些错误,我会卸载所有Google支持包和Xamarin表单。 Then just download Xamarin Forms and it will install the correct version. 然后只需下载Xamarin Forms即可安装正确的版本。

The best option is to never to an Update All in Xamarin in the future. 最好的选择是永远不要在Xamarin中更新全部。

Then after this is done the Resource.Designer.cs file might still cause some issues. 完成此操作后,Resource.Designer.cs文件可能仍会导致一些问题。 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. 至于您的许可错误,请确保您更新到最新版本的Xamarin。

  1. Go to Tools > Options 转到工具>选项
  2. Then go to Xamarin > Other 然后去Xamarin>其他
  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. 然后重新启动VS,你应该删除那些许可错误,因为Xamarin在Visual Studio中是免费的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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