16

I have a problem with the Visual Studio 2015 RC Emulator for Android. The emulator is not starting when I'm starting debugging (F5) nor from "Tools > Visual Studio Emulator for Android...". The process is stuck on "Preparing virtual machine" and there is a "Xde.exe" process with 0% CPU usage in Task Manager. This happens for all virtual machines. Previous emulators (pre-RC) were working just fine.

The necessery APIs (19 and 21) are installed according to SDK manager.

I have tried re-installing Visual Studio and also repairing it but it didn't help.

How can I fix that?

Visual Studio Emulator for Android

Update:

Here are logs: http://pastebin.com/xgyTNkJ9 . The [Critical] The operation was canceled. lines are self explenatory. [Critical] Could not launch 'VS Emulator 5.5" KitKat (4.4) HDPI Phone' device.occured when I killed xde.exe in Task manager.

What's weird is a fact that when I import VHD file from %localappdata%\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices into Hyper-V manager it works just fine and I can even start it and use it. Unfortunately, I still can't debug application from Visual Studio that way.

Update 2:

So I've reinstalled the Windows on my notebook and same thing happens after installing Visual Studio 2015 RC. So two different hardware, one clean Windows installation and same effect.

Pajdziu
  • 911
  • 1
  • 9
  • 22
  • Was it working pre-RC on the same exact machine? Meaning, did you upgrade your same machine from CTP to RC? – Steve Kennedy May 14 '15 at 18:26
  • @SteveKennedy Yes, both hardware and OS is the same. I have uninstalled the VS CTP6 and then installed RC one. – Pajdziu May 14 '15 at 18:57
  • Do you have admin privileges on the machine? What do the logs say (when launching fails you get an "Open logs" error message under the profile). – John Engel-Kemnetz May 28 '15 at 02:22
  • @JohnKemnetz Yes, I have admin priviliges. Here are the logs: http://pastebin.com/Ggq7Jmp7 (Critical line is a result of stopping the process). – Pajdziu May 28 '15 at 14:49
  • @PajdziuPaj My comment won't solve your problem, but it may save you some time while we wait for an answer. Use [genymotion](https://www.genymotion.com) for an Android Emulator and test your project using Debug > Android > Device. It's very similar to `Visual Studio Emulator for Android` and has a lot of virtual devices. In fact, if you don't have it, you should download it since it works so well. Hope this helps! – DeanB_Develop May 29 '15 at 17:34
  • @DeanB_Develop I know about Genymotion :) Anyway, thanks for the advice! – Pajdziu May 29 '15 at 18:30
  • I have this problem too. I'm running Win 8.1, Hyper-V is enabled in BIOS and in Windows. Xamarin is installed as is Visual sTudio 2015 RC. Trying to start the emulator it never gets passed the "preparing virtual machine" and usually it end with an error message saying it needs to reboot the machine. – Måns Tånneryd Jun 07 '15 at 21:41
  • I've submitted bug on MS Connect related to this: https://connect.microsoft.com/VisualStudio/feedback/details/1438882 – veeroo Jun 16 '15 at 09:31
  • Possible duplicate of [Visual studio (2015) emulator for android not working - XDE.exe - Exit Code 3](http://stackoverflow.com/questions/31613607/visual-studio-2015-emulator-for-android-not-working-xde-exe-exit-code-3) – Gyum Fox Jan 21 '16 at 09:22

4 Answers4

2

This might be a duplicate of Visual studio (2015) emulator for android not working - XDE.exe - Exit Code 3.

I was having the same issue as yourself and this was solved by following the steps provided in this answer: https://stackoverflow.com/a/31698124/1010492.

The key for me was to disable the Network Sharing I had set on my Wi-fi adapter.

Community
  • 1
  • 1
Gyum Fox
  • 3,287
  • 2
  • 41
  • 71
0

You are probably not a member of the Hyper-V Admins group on the computer. Do this:

  1. Open Control Panel > Administrative Tools > Computer Management.
  2. Expand "Local Users and Groups" and then click on "Groups."
  3. Double click on "Hyper-V Administrators" group.
  4. Click "Add" and add your username to the group.

If the group doesn't exist, you can create it using the PowerShell script in this blog post: http://blogs.msdn.com/b/virtual_pc_guy/archive/2010/09/28/creating-a-hyper-v-administrators-local-group-through-powershell.aspx

John Engel-Kemnetz
  • 2,527
  • 22
  • 22
  • Unfortunately, I didn't work either. I check the "Hyper-V Administrators" group and my username was already there. I check with `echo %username%` in CMD if I didn't make any mistake and the names are the same. I've tried to add to the group the administrator and run VS as administrator but result was the same. Anyway, thanks for the help :) – Pajdziu Jun 01 '15 at 21:21
  • @KamilPajdzik - What OS are you running? Is it a Windows Server product? We've seen this error if you've got Windows Server without Desktop Experience enabled. – John Engel-Kemnetz Jun 02 '15 at 00:13
  • @KamilPajdzik, if that's not the issue, then in command prompt, run C:\Program Files (x86)\Microsoft XDE\10.0.10121.0\xde.exe /sku Android /displayName "VS Emulator 5\" Lollipop (5.0) XXHDPI Phone" /memSize 2048 /diagonalSize 5 /video "1080x1920" /vhd "C:\Users\\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\5_Lollipop_(5.0)_XXHDPI_Phone\image.vhd" /name "VS Emulator 5-inch Lollipop (5.0) XXHDPI Phone." *replace with your user name. Then type "echo %errorlevel%" in cmd.exe to get the exit code. Let me know the errors & exit code – John Engel-Kemnetz Jun 02 '15 at 00:20
  • I'm running Windows 8.1 Enterprise N version. I'll the command and post the result. – Pajdziu Jun 02 '15 at 08:43
  • I have different version of XDE installed (could this be a problem? I've tried repairing the VS and it hasn't been updated) so I changed the path to 10.0.1.0 version. [Here](http://pastebin.com/qtFvjZCm) is the log. The `echo %errorcode%` returned 9009. – Pajdziu Jun 02 '15 at 09:28
-1

It may be that you do not have enough memory available to start the Hyper-V VM. If you go to Hyper-V Manager and attempt to start the emulator image, you'll be able to see if it starts at all or if you don't have enough free RAM on the machine.

John Engel-Kemnetz
  • 2,527
  • 22
  • 22
  • 1
    I have 16 GB of RAM and I can start every Windows Phone emulator or Windows 7 virtual machine just fine. Also, there is no Android emulator in Hyper-V Manager. – Pajdziu May 15 '15 at 06:42
-6

I came up with a very genuine solution that can fulfill your basic need of running the emulator. All you need to do is follow these steps:

  1. Sign in to https://www.genymotion.com/account/login/
  2. Download Genymotion from there.
  3. First Download and run the Emulator of your own choice from Genymotion. [Start the Emulator From Start Button][2]
  4. Then Keep it running and Open the Visual Studio.
  5. Open your Solution,and while your Genymotion Emulator Running,You will see that at Play option,you will be having new Emulator device which will be Genymotion Device.

  6. Deploy using that device.

  7. Hurray!! Your Solution is Successful.