简体   繁体   English

Visual Studio android模拟器无法完全启动

[英]Visual studio android emulator will not start fully

I create a blank cordova application in visual studio 2015 and start debugging with the visual studio android emulators (first with the lollipop and then kitkat). 我在visual studio 2015中创建了一个空白的cordova应用程序,并开始使用visual studio android模拟器进行调试(首先使用棒棒糖,然后使用kitkat)。 XDE starts and the screen displays OS is starting... . XDE启动,屏幕显示OS is starting... It stays like that for quite a while until it displays 它会持续很长一段时间才显示出来

The emulator is unable to connect to the device operating system; The device did not response to the connect request. Some functionalities might be disabled'

After closing the dialog, it stays there forever until I kill the emulator. 关闭对话框后,它会一直存在,直到我杀死模拟器。 Killing the emulator triggers an error from visual studio. 杀死模拟器会触发visual studio的错误。

Could not start emulated device 'VS Emulator Lollipop Phone'.

When I open hyper-v, I see the vm in the list and shown as running. 当我打开hyper-v时,我在列表中看到vm并显示为正在运行。 When I connect, I see the console screen as below 当我连接时,我看到如下控制台屏幕

屏幕

I know this issue has been around for a while now, but I have just found a new solution for people who may still encounter this issue... 我知道这个问题已经存在了一段时间了,但我刚刚为可能仍会遇到这个问题的人找到了一个新的解决方案......

I had the same issue (stuck on "OS Is Starting") for API v 21 & 22. API v23 images would start, but could not debug - the app would crash as soon as it launched. 对于API v 21和22,我遇到了同样的问题(坚持“OS正在启动”).API v23图像将启动,但无法调试 - 应用程序一启动就会崩溃。

The following fixed the issue: 以下修复了该问题:

  • Shut down the emulator 关闭模拟器
  • Open Hyper-V manager 打开Hyper-V管理器
  • Go to the settings for the Android Image 转到Android Image的设置
  • Expand the "Processor" configuration node 展开“处理器”配置节点
  • Go to the "Compatibility" node 转到“兼容性”节点
  • Check the "Migrate to a physical computer with a different processor version" option 选中“迁移到具有不同处理器版本的物理计算机”选项

Apparently it has something to do with newer Processor architectures being incompatible with the Android images or something like that - don't really care, as long as it works :) 显然它与较新的处理器架构有关,与Android图像或类似的东西不兼容 - 只要它工作,不要真正关心:)

I was running into the same issue. 我遇到了同样的问题。 I did try to disable OpenGL by deleting: GuestDisplayProvider = "VsEmulator.OpenGLGuestDisplay" in xdesku.xml, as suggested in other answers. 我试图通过在xdesku.xml中删除:GuestDisplayProvider =“VsEmulator.OpenGLGuestDisplay”来禁用OpenGL,如其他答案所示。

At first, the virtual machine would boot up (you could connect to it from Hyper-V manager), but the emulator window itself would not connect to the machine (stuck on "OS is starting", then failing after a looooong while with the following message: "The emulator is unable to connect to the device operating system: Couldn't auto-detect the guest system IP address. Some functionality might be disabled.") 首先,虚拟机将启动(您可以从Hyper-V管理器连接到它),但模拟器窗口本身不会连接到机器(卡在“操作系统正在启动”,然后失败后,在使用以下消息:“模拟器无法连接到设备操作系统:无法自动检测客户机系统IP地址。某些功能可能已禁用。”)

This answer https://stackoverflow.com/a/31698124/1010492 and that one https://stackoverflow.com/a/14402740/1010492 helped me solve the connectivity issue, and I was able to have the Virtual Machine displayed inside the emulator window. 这个答案https://stackoverflow.com/a/31698124/1010492和那个https://stackoverflow.com/a/14402740/1010492帮助我解决了连接问题,我能够将虚拟机显示在模拟器窗口。

However, the emulator wasn't working properly (scaling issues, no Home, Back, etc. buttons) until I put back the line "VsEmulator.OpenGLGuestDisplay" and after removing my profiles and rebooting a number of times. 但是,模拟器无法正常工作(缩放问题,没有Home,Back等按钮),直到我放回“VsEmulator.OpenGLGuestDisplay”行并删除我的配置文件并重新启动多次。

To sum up, if you are encountering the same issue on an Hyper-V enabled computer, you may want to try the --over conscious-- following steps: 总而言之,如果您在启用Hyper-V的计算机上遇到相同的问题,您可能需要尝试--over conscious--以下步骤:

  1. Ideally, uninstall any other Virtualisation software such as VMWare, Virtual Box and VPN clients such as Cisco VPN (if you cannot do that, please be vigilant at step 13) 理想情况下,卸载任何其他虚拟化软件,如VMWare,Virtual Box和VPN客户端(如Cisco VPN)(如果您不能这样做,请在步骤13保持警惕)
  2. Reboot 重启
  3. In the "Visual Studio Emulator for Android" dialog, delete all installed device profiles 在“Visual Studio Emulator for Android”对话框中,删除所有已安装的设备配置文件
  4. Remove All Hyper-V virtual switches - go to Hyper-V > Virtual switch manager > Remove all virtual switches 删除所有Hyper-V虚拟交换机 - 转至Hyper-V>虚拟交换机管理器>删除所有虚拟交换机
  5. Run XdeCleanup.exe (usually in "C:\\Program Files (x86)\\Microsoft XDE\\10.0.10240.0") 运行XdeCleanup.exe(通常在“C:\\ Program Files(x86)\\ Microsoft XDE \\ 10.0.10240.0”中)
  6. Also remove any extra virtual network adapters left in "Control Panel > Network and Internet > Network Connections" (after following the previous steps, you should normally be left with only physical adapters) 同时删除“控制面板>网络和Internet>网络连接”中剩余的任何额外虚拟网络适配器(按照前面的步骤操作后,通常只能使用物理适配器)
  7. Make sure Network Sharing is disabled on all network adapters (right click, Properties, Sharing, untick "Allow other network users to connect through this computer's Internet connection") 确保在所有网络适配器上禁用网络共享(右键单击,属性,共享,取消选中“允许其他网络用户通过此计算机的Internet连接进行连接”)
  8. If ever you deleted the line GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay" in xdesku.xml (usually in "C:\\Program Files (x86)\\Microsoft XDE\\10.0.10240.0\\SKUs\\Android"), NOW IS A GOOD TIME TO PUT IN BACK. 如果您在GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay"删除了GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay"行(通常在“C:\\ Program Files(x86)\\ Microsoft XDE \\ 10.0.10240.0 \\ SKUs \\ Android”中),现在是一个很好的时机在后面。
  9. Reboot 重启
  10. You may want to try to repair the emulators: go to Programs and Features > Microsoft Visual Studio Emulator for Android > Change and hit "Repair" (although I have to say this always fails for me) 您可能想尝试修复模拟器:转到程序和功能>用于Android的Microsoft Visual Studio模拟器>更改并点击“修复”(虽然我不得不说这总是对我失败)
  11. Reboot 重启
  12. Open the Visual Studio Emulator for Android, and install then run one of the profiles (eg: 7'' KitKat (4.4) XHDPI Tablet -- Similar to Asus Google Nexus 7) 打开Android的Visual Studio模拟器,然后安装然后运行其中一个配置文件(例如:7''KitKat(4.4)XHDPI Tablet - 与Asus Google Nexus 7类似)
  13. It may already work, but if not you should make sure that your network adapters are setup properly. 它可能已经工作,但如果没有,你应该确保你的网络适配器设置正确。 Stop your emulator, then Go to Control Panel > Network and Internet > Network Connections, and right click the vEthernet adapters, then Properties and make sure you only have the following boxes ticked in the Networking list (as explained in Interference from other virtualization or networking software and drivers : Client for Microsoft Networks, QoS Packet Scheduler, File and Printer Sharing for Microsoft Networks, Microsoft LLDP Protocol Driver, Link-Layer Topology Discovery Mapper I/O Driver, Link-Layer Topology Discovery Responder, Internet Protocol Version 6 (TCP/IPv6), Internet Protocol Version 4 (TCP/IPv4) 停止模拟器,然后转到“控制面板”>“网络和Internet”>“网络连接”,右键单击vEthernet适配器,然后单击“属性”,确保只在“网络”列表中勾选以下框(如其他虚拟化或网络中的干扰所述)软件和驱动程序 :Microsoft网络客户端,QoS数据包计划程序,Microsoft网络文件和打印机共享,Microsoft LLDP协议驱动程序,链路层拓扑发现映射器I / O驱动程序,链路层拓扑发现响应程序,Internet协议版本6(TCP / IPv6),Internet协议版本4(TCP / IPv4)
  14. Reboot 重启
  15. Try to start the emulator again in "Visual Studio Emulator for Android" 尝试在“Visual Studio Emulator for Android”中再次启动模拟器
  16. If it still doesn't work, try to delete and recreate the profiles, and loads of reboots... 如果它仍然不起作用,请尝试删除并重新创建配置文件,并重新启动...

There are probably some redundants steps here, but I think it covers everything you should try (the key seems to be making sure that the network adapters are setup properly). 这里可能有一些冗余步骤,但我认为它涵盖了你应该尝试的一切(关键似乎是确保网络适配器设置正确)。 If I've missing some things or if you think some steps are useless, please comment. 如果我遗漏了一些东西,或者你认为某些步骤没用,请发表评论。

After alot of searching I got this working. 经过大量的搜索,我得到了这个工作。 Hope this helps. 希望这可以帮助。 I found it in the comments on MSDN Article for Android Emulator with Visual Studio 2015 我在使用Visual Studio 2015的Android模拟器MSDN文章的评论中找到了它

The new images might work if you disable OpenGL by going to Program Files (or Program Files x86 if you're on a 64-bit machine) \\ Microsoft XDE \\ 10.0.0.0 \\ SKUs \\ Android \\ xdesku.xml and deleting this line: GuestDisplayProvider = "VsEmulator.OpenGLGuestDisplay". 如果您通过转到Program Files(如果您使用的是64位计算机上的Program Files x86)或Microsoft XDE \\ 10.0.0.0 \\ SKUs \\ Android \\ xdesku.xml并删除此行,则禁用OpenGL可能会有效: GuestDisplayProvider =“VsEmulator.OpenGLGuestDisplay”。 However, without OpenGL turned on you will not be able to take advantage of many of the new features 但是,如果没有打开OpenGL,您将无法利用许多新功能

On my system I got it working again after enabling the disabled vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch) again. 在我的系统上,我再次启用了禁用的vEthernet(内部以太网端口Windows Phone仿真器内部交换机)后再次运行。 I didn't have to reboot. 我没有重启。

I went through the steps in @Gyum Fox answer and still no joy for me. 我经历了@Gyum Fox回答的步骤,对我来说仍然没有快乐。

While the Visual Studio Emulator for Android creates the first emulator instance, several virtual network switches are also created. 虽然用于Android的Visual Studio模拟器创建了第一个模拟器实例,但还创建了多个虚拟网络交换机。 For a laptop, typically three vEthernet instances are created; 对于笔记本电脑,通常会创建三个vEthernet实例; one for the wired LAN, one for the Wi-Fi, and another internal virtual switch for guest to host connections. 一个用于有线LAN,一个用于Wi-Fi,另一个用于客户端到主机连接的内部虚拟交换机。

In my case, the vEthernet for the wired LAN was created successfully and then the Visual Studio Emulator for Android process would hang. 就我而言,有线局域网的vEthernet已成功创建,然后Visual Studio Emulator for Android进程将挂起。 This is observable from the Hyper-V Manager and the Virtual Switch Manager action. 这可以从Hyper-V管理器Virtual Switch Manager操作中观察到。

Using the Virtual Switch Manager I successfully created the missing Wi-Fi virtual switch with these steps. 使用Virtual Switch Manager我通过以下步骤成功创建了缺少的Wi-Fi虚拟交换机。 Well, ultimately it worked. 好吧,最终它奏效了。 Read on. 继续阅读。

  1. Under the Virtual Switches list, select New virtual network switch… Virtual Switches列表下,选择New virtual network switch ...
  2. Under What type of virtual switch do you want to create? 您要创建什么类型的虚拟交换机? , select External . ,选择外部
  3. Under the External network: drop-down, select the Wi-Fi adapter. 外部网络:下拉列表中,选择Wi-Fi适配器。
  4. Click the Create Virtual Switch button. 单击“ 创建虚拟交换机”按钮。
  5. Change the Name: to match the name of your Wi-Fi adapter. 更改名称:以匹配Wi-Fi适配器的名称。
  6. Click the Apply button. 单击“ 应用”按钮。

In my case though, after clicking Apply , a failure message indicated the Wi-Fi adapter was bridged. 但在我的情况下,单击“ 应用”后 ,失败消息表明Wi-Fi适配器已桥接。 Hmmm. 嗯。

I started the View Network Connections control panel applet and the Wi-Fi adapter did not show it was bridged. 我启动了View Network Connections控制面板小程序,而Wi-Fi适配器没有显示它已被桥接。 (When a network bridge exists, the Status column has the word Bridged appended.) I suspect there was some dusty digital bits lurking somewhere in the registry. (当存在网桥时,“ 状态”列会附加“ 桥接 ”一词。)我怀疑在注册表中某处隐藏着一些尘土飞扬的数字位。

Here is what cleared the issue for me. 这就是为我解决问题的原因。

  1. Right-click on the Wi-Fi device. 右键单击Wi-Fi设备。
  2. Select Add to Bridge . 选择添加到桥
  3. Right-click on the Wi-Fi device, again. 再次右键单击Wi-Fi设备。
  4. Select Remove from Bridge . 选择从桥中删除

Now, go back up to the steps to create the virtual switch for the Wi-Fi network. 现在,返回到为Wi-Fi网络创建虚拟交换机的步骤。 The steps should complete successfully now. 这些步骤现在应该成功完成。

And now, you can go back to creating the Android emulators you want. 现在,您可以返回创建所需的Android模拟器。

One final thought… If you aren't seeing any virtual switches being created, I suspect that could mean the wired LAN might have the dusty digital bits hanging you up. 最后一个想法......如果你没有看到任何虚拟交换机被创建,我怀疑这可能意味着有线局域网可能会让你满身灰尘。 In that case, I'd try add-and-remove-from-bridge trick on the wired LAN adapter to see if that clear things up for you. 在这种情况下,我会尝试在有线LAN适配器上添加并删除桥接技巧,以查看是否为您提供了清晰的功能。

And, now I suppose that just doing the add-and-remove-from-bridge trick on the network adapter without creating the virtual switch might suffice. 而且,现在我认为只需在网络适配器上执行添加和删除桥接技巧而无需创建虚拟交换机就足够了。 For me, the creation of the virtual switch was proof that the issue was corrected. 对我来说,虚拟交换机的创建证明问题已得到纠正。 YMMV ;-) YMMV ;-)

I found my issue was related to the windows firewall with some enterprise policies my company applied to all PCs. 我发现我的问题与Windows防火墙有关,我的公司应用于所有PC的一些企业策略。 Once I stopped the Windows Firewall service it worked just fine. 一旦我停止了Windows防火墙服务,它工作得很好。

I also had this issue and it was not just for android emulators but for all windows phone emulators. 我也有这个问题,它不仅适用于Android模拟器,而且适用于所有Windows手机模拟器。

This is what i did to fix the issue 这就是我为解决这个问题所做的工作

After this I was able to run the emulator from "Visual Studio Emulators for Android" 在此之后,我能够从“Visual Studio Emulators for Android”运行模拟器

I'm adding a separate answer though the insight provided by Gyum Fox provided the clues I needed to try other stuff ... 我正在添加一个单独的答案虽然Gyum Fox提供的洞察力提供了我需要尝试其他东西的线索......

[NOTE: The last time I was able to use the emulators (~3 weeks ago) I had wireless disabled and was using a wired connection on my Dev laptop. [注意:上次我能够使用模拟器(约3周前)我无线禁用,并在我的Dev笔记本电脑上使用有线连接。 I ran out of space on my switch so re-enabled the wireless as the sole connectivity option. 我的交换机空间不足,因此重新启用无线作为唯一的连接选项。 This may be totally coincidental, but read on and I'll let y'all decide.] 这可能完全是巧合,但请继续阅读,我会让你们自己决定。

After following Gyum's steps without success, I decided to turn off the wireless and then try launching the emulator. 按照Gyum的步骤没有成功,我决定关闭无线,然后尝试启动模拟器。

Wouldn't you know it ... it worked without an issue! 你不知道吗......它没有问题! 8-} 8}

Once I had the emulator running, I re-enabled the wireless and the emulator picked up the connectivity. 一旦我运行了模拟器,我就重新启用了无线功能,模拟器选择了连接。

I'm not a network guy so I'm not even gonna attempt to understand. 我不是网络人,所以我甚至都不会尝试理解。 It's a minor PITA but hey ... if it works!!! 这是一个小PITA,但嘿......如果有效! ;-} ; - }

On my machine I could start the emulator but I got an OpenGL error when trying to deploy and debug. 在我的机器上,我可以启动模拟器,但在尝试部署和调试时遇到了OpenGL错误。 I realized my issues started after I installed Docker. 我意识到在安装Docker之后我的问题就开始了。 On a whim I decided to shut down Docker and disable the vEthernet (DockerNAT) Network Connection. 一时兴起,我决定关闭Docker并禁用vEthernet(DockerNAT)网络连接。 This fixed my issue. 这解决了我的问题。 Now, whenever I need to use the Andoird emulator I have to shut down Docker. 现在,每当我需要使用Andoird模拟器时,我必须关闭Docker。 Then when I'm done debugging I enable/restart Docker. 然后,当我完成调试时,我启用/重启Docker。

One of the reason I was having this issue is that I did not install the Android SDK on the default location. 我遇到此问题的原因之一是我没有在默认位置安装Android SDK。 So I had to follow these instructions in order to be able to debug my application: https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB 所以我必须按照这些说明才能调试我的应用程序: https//msdn.microsoft.com/en-us/library/mt228282.aspx#ADB

I had to create the folder "Android SDK Tools" and add the Key "Path" with the value to my SDK, which in my case it was "E:\\Android\\Android_SDK" 我必须创建文件夹“Android SDK Tools”并将值“Path”添加到我的SDK中,在我的例子中它是“E:\\ Android \\ Android_SDK”

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

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