Visual studio android emulator will not start fully
Asked Answered
H

10

20

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). XDE starts and the screen displays 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.

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. When I connect, I see the console screen as below

screen

Hypogeal answered 9/4, 2015 at 19:44 Comment(0)
T
29

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.

The following fixed the issue:

  • Shut down the emulator
  • Open Hyper-V manager
  • Go to the settings for the 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 :)

Trichloride answered 17/12, 2015 at 7:44 Comment(4)
This was exactly my issue. API 21 & 22 images would start but VS could not deploy app to it. Turning on that option worked beautifully. Thanks!Sauder
Thank you! This was the only solution on this page that worked for me on a Surface Pro 4 (i7 6650U)Rousing
This also resolved my issues with API 21, 22, and 23 devices. 21&22 wouldn't get past "OS Is Starting" and on 23, the settings app crashed when I pressed "About Phone" to try to turn on Developer Settings. If anyone else also ran into this is doing React Native stuff, you'll also need to run adb reverse tcp:8081 tcp:8081.Zolner
This solution worked for me as well! Came right up. What I would suggest is edit your answer to include a screen capture or two as the only difficulty I had with your answer is finding the exact location to check that checkbox.Amaris
L
20

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.

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.")

This answer https://mcmap.net/q/333645/-visual-studio-2015-emulator-for-android-not-working-xde-exe-exit-code-3 and that one https://mcmap.net/q/327735/-windows-phone-8-emulator-error-something-happened-while-creating-a-switch helped me solve the connectivity issue, and I was able to have the Virtual Machine displayed inside the emulator window.

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.

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:

  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)
  2. Reboot
  3. In the "Visual Studio Emulator for Android" dialog, delete all installed device profiles
  4. Remove All Hyper-V virtual switches - go to Hyper-V > Virtual switch manager > Remove all virtual switches
  5. Run XdeCleanup.exe (usually in "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)
  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")
  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.
  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)
  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)
  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)
  14. Reboot
  15. Try to start the emulator again in "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.

Lorou answered 5/8, 2015 at 8:2 Comment(2)
Finally! I went through so many different "solutions" but this was the one that worked for me. My problem was that the android virtual machine did start and work when I launched it directly from hyper-v manager (or what ever it is called), but the vs emulator just gave me "unknown exit codes". Thanks!Pryer
Your solution worked for me. I've noticed that this happened after I played with Ethernet adapter settings, apparently Hyper-V doesn't like changing network settings.Maxilliped
D
6

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

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". However, without OpenGL turned on you will not be able to take advantage of many of the new features

Deductible answered 10/4, 2015 at 11:37 Comment(10)
I just tried it with some success. The XDE window displays OS is starting and it has been there for a very long time. When I open the hyper-v and Connect to the running VM, it realize that it has booted successfully and I can interface with it. I think the problem now is to get XDE to recognize it.Hypogeal
This Setup works for me is.VMware Player 7. 2 Processor Cores. Virtualize intel VT-x/EPT or AMD-V/RVI and also Virtualize CPU performance counter ticked. I also within the VMX file for my virtual machine have added hypervisor.cpuid.v0 = "FALSE" and saved the file. (Note: you maybe need to add the line a few rows from the bottom as it removed it after opening the VM if i had it at the bottom of the file). All these steps together opens the Android Emulator in XDE window. I can then utilise the tools to rotate and tilt the device and see the XDE window change from landscape to portrait etc..Deductible
Are you saying I should install VMware Player? Won't take interfere with hyper-v?Hypogeal
For my particular setup. I only got your error when running it within a VM. Is this the same scenario for you or have you Visual Studio 2015 CTP 6 running on your host machine? As you mentioned hyper-V and VMWare do not work together however running hyper-v inside of a vm run using vmplayer/vmware does work.Deductible
I am using NativeBoot. Only the hard drive is virtualized. I dual boot into the windows 10.Hypogeal
I'm sorry i haven't used that setup before. Hopefully it will get resolved for the release candidate.Deductible
@Hypogeal were you able to solve your problem? Im running into the same issue (the VM is running, I can connect to it using hyper-v manager, but nothing is displayed in the emulator window)Lorou
@ritcoder: I finally fixed the issue we were having. You can actually find similar posts regarding the Windows Phone emulator. The solution is to cleanup your virtual adapter: https://mcmap.net/q/327735/-windows-phone-8-emulator-error-something-happened-while-creating-a-switch (see also: msdn.microsoft.com/library/windows/apps/… "Interference from other virtualization or networking software and drivers"). On my side, it was an interference caused by VMWare.Lorou
@GyumFox Noted. I'll check it out. I'll be formatting the machine soon to move to Win10 soon so will see if the same issue persists.Hypogeal
@Hypogeal Moreover, after much fiddling, I got it to work on my hyper-v machine without removing the line GuestDisplayProvider = "VsEmulator.OpenGLGuestDisplay". (although it didn't work at first: I was still having the same error. It started working after several reboots, no idea why). I'll be posting a new answer.Lorou
I
1

On my system I got it working again after enabling the disabled vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch) again. I didn't have to reboot.

Imbrication answered 16/3, 2016 at 23:13 Comment(1)
Jepp, that was my solution! Thanks Bart, a bit embarrassing for an old network engineer to not find this him self ;) Didn't even look in the network settings until I read this. and yes it was inactive, due to an installation of virtual box last week.Shrieve
J
1

I went through the steps in @Gyum Fox answer and still no joy for me.

While the Visual Studio Emulator for Android creates the first emulator instance, several virtual network switches are also created. For a laptop, typically three vEthernet instances are created; one for the wired LAN, one for the Wi-Fi, and another internal virtual switch for guest to host connections.

In my case, the vEthernet for the wired LAN was created successfully and then the Visual Studio Emulator for Android process would hang. This is observable from the Hyper-V Manager and the Virtual Switch Manager action.

Using the Virtual Switch Manager I successfully created the missing Wi-Fi virtual switch with these steps. Well, ultimately it worked. Read on.

  1. Under the Virtual Switches list, select 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.
  4. Click the Create Virtual Switch button.
  5. Change the Name: to match the name of your Wi-Fi adapter.
  6. Click the Apply button.

In my case though, after clicking Apply, a failure message indicated the Wi-Fi adapter was bridged. Hmmm.

I started the View Network Connections control panel applet and the Wi-Fi adapter did not show it was bridged. (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.
  2. Select Add to Bridge.
  3. Right-click on the Wi-Fi device, again.
  4. Select Remove from Bridge.

Now, go back up to the steps to create the virtual switch for the Wi-Fi network. The steps should complete successfully now.

And now, you can go back to creating the Android emulators you want.

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.

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 ;-)

Juxtapose answered 6/5, 2016 at 15:46 Comment(0)
R
1

I found my issue was related to the windows firewall with some enterprise policies my company applied to all PCs. Once I stopped the Windows Firewall service it worked just fine.

Rigid answered 29/5, 2016 at 16:39 Comment(0)
T
1

I also had this issue and it was not just for android emulators but for all windows phone emulators.

This is what i did to fix the issue

After this I was able to run the emulator from "Visual Studio Emulators for Android"

Tartar answered 5/7, 2016 at 6:8 Comment(0)
E
0

I'm adding a separate answer though the insight provided by Gyum Fox provided the clues I needed to try other stuff ...

[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. 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.

Wouldn't you know it ... it worked without an issue! 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!!! ;-}

Eclat answered 20/9, 2015 at 0:32 Comment(0)
B
0

On my machine I could start the emulator but I got an OpenGL error when trying to deploy and debug. I realized my issues started after I installed Docker. On a whim I decided to shut down Docker and disable the vEthernet (DockerNAT) Network Connection. This fixed my issue. Now, whenever I need to use the Andoird emulator I have to shut down Docker. Then when I'm done debugging I enable/restart Docker.

Burglary answered 28/10, 2016 at 15:34 Comment(0)
I
0

One of the reason I was having this issue is that I did not install the Android SDK on the default location. 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

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"

Intelligencer answered 9/12, 2017 at 19:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.