本文介绍了Xamarin.Forms Visual Studio 2017 项目未部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Xamarin 的新手.我使用了 Xamarin.在 Visual Studio 2017 中创建示例移动解决方案的表单模板.该过程创建了四个项目 Xamarin PCL、Xamarin Android、Xamarin.iOS 和 Xamarin.UWP.在不对生成的解决方案进行任何修改的情况下,我正在尝试运行它.

I am new to Xamarin. I used Xamarin. Forms template to create a sample mobile solution in Visual Studio 2017. The process created four projects Xamarin PCL, Xamarin Android, Xamarin.iOS and Xamarin.UWP. Without making any modification to the generated solution, I am trying to run it.

第一个问题是,当我将 UWP 设置为启动项目时,Windows 模拟器出现并完美运行应用程序.但是当我尝试对 Android 做同样的事情时,我会根据我所做的环境更改在不同时间收到不同的错误.最后,使用visual studio android 模拟器,手机用户界面显示但不是我的应用程序.在后台,我可以看到 Visual Studio 成功完成了构建过程,没有任何错误,但部署过程只是挂起.我让部署在一夜之间运行,但仍然在早上运行.这是我的环境.

The first issue is, when I set the UWP as the starting project, the Windows emulator shows up and runs the app perfectly. But when I try to do the same with Android, I get different errors at different times based on the environment changes I make. Finally, using the visual studio android emulator, the Phone UI shows up but not my app. In the background, I can see that Visual Studio completed the build process successfully without any errors but the deploy process simply hangs. I left the deploy running overnight but still running in the morning. Here is my environment.

  • 英特尔酷睿 i7 处理器
  • 在 BIOS 中启用虚拟化
  • Windows 10 教育版
  • 32GB 内存
  • 在 Windows 中禁用 Hyper-V
  • 在命令窗口中执行 bcdedit/set hypervisorlaunchtype off 并重新启动.
  • Intel Core i7 processor
  • Virtualization enabled in BIOS
  • Windows 10 Education
  • 32GB RAM
  • Hyper-V disabled in Windows
  • Executed bcdedit /set hypervisorlaunchtype off in the command window and rebooted.

我尝试以不同的组合设置上述环境,但似乎没有一个可以使应用程序正常工作.当我使用来自 android SDK 的 android 模拟器时,构建过程会引发错误.唯一可以构建的模拟器是 Visual Studio 模拟器.但部署挂起.

I tried setting the above environment in different combinations but none of them seem to make the app work. When I use an android emulator from android SDK, the build process throws errors. The only emulator that even builds is the visual studio emulator. But the deploy hangs.

我的第二个问题是,我已经安装了 24 版和 25 版的 android SDK.但在模拟器下拉列表中,我只能看到 23 版的模拟器.我在 Visual Studio 和 android SDK 管理器中检查了安装路径,然后它们都指向同一个安装文件夹.我需要什么才能使版本 24 和 25 的模拟器可用?

A second issue I have is, I have installed android SDK for version 24 and 25. But in the emulator dropdown, I can only see the emulators for 23. I checked the installation path both in visual studio and android SDK manager and they both point to the same installation folder. What do I need to make the emulators for version 24 and 25 usable?

我再说一遍,在运行它之前,我没有对 Visual Studio 中生成的解决方案进行任何更改.过去三天我一直在处理它,但无法让它发挥作用.请帮忙.

I repeat, I did not make any change to the generated solution in visual studio before running it. I have been at it for the past three days and couldn't make it work. Please help.

推荐答案

经过这几天的纠结,我终于得到了我的 Xamarin.Forms Android 应用程序,可以在模拟器上显示我的页面.感谢所有成员的建议.Ryan 的建议很有帮助(我给他 +1,感谢 Ryan)但没有解决我的问题.我进一步搜索并找到了一个建议,该建议要求更改以下设置,最终为我做到了.所以,如果其他人像我一样卡住了,请执行以下操作(除了清理和更新所有包):

After pulling my hair for the past few days, I finally got my Xamarin.Forms Android App to show my page on the emulator. Thanks to all the members for their suggestions. Ryan's suggestion helped a lot ( I +1ed him, thanks Ryan) but did not solve my problem. I googled further and found a suggestion that asked to change the following setting which did it for me finally. So, if anyone else get stuck like I did, please do the following (in addition to cleaning up and updating all packages):

  • 为模拟器打开 Hyper-V 虚拟机的设置(当虚拟机关闭时).
  • 展开左侧的处理器节点,然后单击兼容性".
  • 现在勾选右侧的迁移到具有不同处理器版本的物理计算机".
  • 在 Visual Studio 模拟器工具中启动模拟器.
  • 现在,使用已经运行的同一个模拟器在 VS 中开始调试您的 android 项目.
  • 经过一段延迟(总会有一段延迟),您的应用将显示在模拟器上.耶!!

这篇关于Xamarin.Forms Visual Studio 2017 项目未部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 11:36