Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 462
ritcoder Avatar asked Apr 09 '15 19:04

ritcoder


People also ask

Why is my emulator not working Android Studio?

If the Android Emulator does not start properly, this problem is often caused by problems with HAXM. HAXM issues are often the result of conflicts with other virtualization technologies, incorrect settings, or an out-of-date HAXM driver. Try reinstalling the HAXM driver, using the steps detailed in Installing HAXM.

How do I enable emulator in Visual Studio?

On the General tab, under Deployment Target Options change the Target option to "Open Select Deployment Target Dialog" and check the "Use same device for future launches" option, so that we can be prompted to select an emulator when we run a project in Android Studio: Go ahead and run your app.


2 Answers

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

like image 70
Trashcoder Avatar answered Nov 03 '22 10:11

Trashcoder


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://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.

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.

like image 24
Gyum Fox Avatar answered Nov 03 '22 12:11

Gyum Fox