Visual studio (2015) emulator for android not working - XDE.exe - Exit Code 3
Asked Answered
J

16

55

I have created a new Blank App (Xamarin.Forms Portable) project in Visual Studio 2015.

When I try to run Droid project in Visual Studio Emulator for Android, I just get a generic error message:

An error occured while creating 'VS Emulator 5" KitKat (4.4) XXHDPI Phone' device.

So I looked into Tools->Visual Studio Emulator for Android, and tried to run emulator manually. After a while it fails and log says:

24.7.2015 16:22:52: [Informational] Reinitializing installed profiles.

24.7.2015 16:22:52: [Informational] Installed profiles initialized. Devices: 2 Platforms: 1

24.7.2015 16:22:52: [Informational] Reinitializing installable profiles.

24.7.2015 16:22:52: [Informational] Installable profiles initialized. Devices: 30 Platforms: 4

24.7.2015 16:22:56: [Informational] Waiting to launch device...

24.7.2015 16:22:56: [Informational] Launching Device: 5" KitKat (4.4) XXHDPI Phone

24.7.2015 16:22:56: [Informational] Validating emulator arguments...

24.7.2015 16:22:56: [Informational] Determining if emulator is already running...

24.7.2015 16:22:56: [Informational] Preparing virtual machine...

24.7.2015 16:22:58: [Critical] An error occured while creating 'VS Emulator 5" KitKat (4.4) XXHDPI Phone' device.

24.7.2015 16:22:58: [Critical] XDE Path: C:\Program Files (x86)\Microsoft XDE\10.0.10240.0\xde.exe

24.7.2015 16:22:58: [Critical] XDE Arguments: /sku Android /displayName "VS Emulator 5\" KitKat (4.4) XXHDPI Phone" /memSize 2048 /diagonalSize 5 /video "1080x1920" /vhd "C:\Users\lacike\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\5_KitKat_(4.4)_XXHDPI_Phone\image.vhd" /name "VS Emulator 5-inch KitKat (4.4) XXHDPI Phone.lacike" /noStart /silent

24.7.2015 16:22:58: [Critical] XDE Exit Code: 3

However when I run WinPhone project in Windows Phone emulator, it works. It uses XDE.exe like Android Emulator, so Hyper-V network is working.

Any ideas?

UPDATE:

When I tried to install a new device profile, I run to this same issue:

Visual Studio 2015 RC Emulator for Android doesn't start

The process is stuck on "Copying .vhd files and creating virtual machine".

UPDATE 2:

When I open a command prompt and then run xde.exe with following xde arguments:

xde.exe /sku Android /displayName "VS Emulator 5\" KitKat (4.4) XXHDPI Phone" /memSize 2048 /diagonalSize 5 /video "1080x1920" /vhd "C:\Users\lacike\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\5_KitKat_(4.4)_XXHDPI_Phone\image.vhd" /name "VS Emulator 5-inch KitKat (4.4) XXHDPI Phone.lacike

I get following error:Service Host Error

Julee answered 24/7, 2015 at 14:50 Comment(4)
error 3 = ERROR_PATH_NOT_FOUND. Do you see the VHD in "C:\Users\lacike\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\5_KitKat_(4.4)_XXHDPI_Phone\"?Communication
Yes, I do. That folder contains two files: image.version.txt and image.vhdJulee
What OS are you running? Is it Win10? If so, what build?Fyn
No, it isn't. I am using Windows 8.1 Enterprise 64-bit.Julee
J
71

After hours and hours of research, and applying following steps I finally get it working:

1) Repair Android SDK - go to Programs and Features > Microsoft Visual Studio Emulator for Android > Change and hit "Repair"

2) Remove All Hyper-V virtual switches - go to Hyper-V > Virtual switch manager > Remove all virtual switches

3) Run XdeCleanup.exe - In my case: "C:\Program Files (x86)\Microsoft XDE\10.0.10240.0"

4) In my case I had configured Internet connection sharing on Ethernet adapter before so I had to disable it

Julee answered 29/7, 2015 at 10:39 Comment(6)
I was running into the same problem and this did the trick. Please note the importance of step 4 (I had network sharing enabled on my Wi-Fi). I have now been able to pass the "Preparing virtual machine" step. Now "Launching the emulator" (OS is starting). This seems to be taking a while though... I hope I'm not going to get stuck here.Missy
FYI: the OS did fail to start (same as #29548046). But as far as I'm concerned, your answer solves the original question.Missy
I deleted the .suo files underneath the .vs folder. After that my emulators worked and ripple workedPrototrophic
it fixed without step 4.Deane
I couldn't do 2) before I finish 3) because some VMs were still using virtual switches. However, 3) deleted these VMs and all virtual switches. So 2) was, at least for me, not necessary.Obese
One of my colleagues got excited that this question had 70+ upvotes and deleted all Virtual Machines instead of deleting Virtual Switches. Advice: please be careful with step 2. Read the instructions and follow the steps.Marinamarinade
F
8

Usually, the System.ServiceModel.ServiceHost error means there is some residue from a botched installation.

First, go to Task Manager and kill any running XDE processes. If that doesn't fix it, go to Programs and Features > Microsoft Visual Studio Emulator for Android > Change and hit "Repair"

Fyn answered 27/7, 2015 at 17:0 Comment(0)
C
7

I have found the following to work for me:

  1. Disable your WiFi connection.
  2. Launch your app.
  3. Observe Emulator gets loaded
  4. Re-enable WiFi.
  5. Note how restarting your app should not be an issue anymore as long as the emulator is initially loaded.
Colter answered 17/9, 2015 at 14:41 Comment(1)
It could be a solution, but if you use WiFi as a primary connection to the internet, it brings a little discomfort for you.Julee
A
4

I ran into the same problem. However, I have managed to get the emulator running by doing the following. Browse to the xde.exe directory and open a command prompt then run xde.exe with the xde arguments in your log minus the /nostart /silent commands. So in your case:

xde.exe /sku Android /displayName "VS Emulator 5\" KitKat (4.4) XXHDPI Phone" /memSize 2048 /diagonalSize 5 /video "1080x1920" /vhd "C:\Users\lacike\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\5_KitKat_(4.4)_XXHDPI_Phone\image.vhd" /name "VS Emulator 5-inch KitKat (4.4) XXHDPI Phone.lacike"

It's probably also worth opening task manager first and end all running xde.exe processes first.

However I don't have Xamarin, so I'm not able to confirm that this will then let you deploy to the emulator.

Alf answered 25/7, 2015 at 15:20 Comment(4)
Strange, when I run it from command prompt I get this errorJulee
Mhmm, have you tried repairing/reinstalling the Android SDK's via the Visual Studio installer? Also I'm guessing you are using Visual Studio 2015 RTM?Alf
Yes, I am using Visual Studio 2015 RTM, I tried to re-install whole Visual Studio 2015 with all components, but it didn't help.Julee
This helped identify my problem, which turned out to be a bad Hyper-V path. I moved my VMs to a different hard drive, but never updated the default paths in the Hyper-V Settings so it wasn't able to create any new Android emulator images.Abnaki
N
4

Just thought I'd add the solution that solved my problem.

After some digging around I realized that, for some reason, Hypervisor wasn't started with my computer. I have an vague feeling that the VirtualBox setup might be responsible for this, but that is not confirmed.

Anyhow, for me the solution was to enable hypervisor startup at boot time using BCDEDIT.

In an admin console enter:

BCDEDIT /Set {current} hypervisorlaunchtype auto 

and restart the computer.

Nonah answered 20/4, 2016 at 7:4 Comment(1)
+1 I can confirm connection with VirtualBox: On my machine, VirtualBox VMs only start when hypervisorlaunchtype is set to off. VS emulators OTOH only start when hypervisorlaunchtype is set to auto :-/.Rehabilitate
D
3

I did this and my problem was fixed

  • Start cmd.exe with Admin rights and type

  • bcdedit /set hypervisorlaunchtype auto

  • Restart pc.

  • run as administrator visual studio.

Good luck!

Dougie answered 4/11, 2016 at 1:6 Comment(0)
L
2

I had the same problem after installing Android Studio.

Android Studio needs "bcdedit /set hypervisorlaunchtype off"

Visual Studio Emulator for Android needs "bcdedit /set hypervisorlaunchtype auto"

Because of that, I switch to "off" or "auto" and reboot my system.

Lilian answered 5/9, 2016 at 22:3 Comment(1)
Thanks it solved my problem of getting the message n error occured while creating "VS Emulator 5" KitKat (4.4) XXHDPI Phone' device I tried all other solutions in this thread but yours was the only one that workedHysterical
H
1

I think the root cause of the problem varies from machine to machine but seems to have something to do with how the Device Drivers of various network interfaces interact with the HyperV system (by the way, I am running Windows 10; some things are bound to be slightly different than Windows 8).

I have a MiFi device that draws power from my laptop's USB port. The device can allow direct connection to it over USB by the host system. When disconnected from the USB port, it routes traffic over WiFi.

@Ladislav's steps were a good starting point for me. It took a lot of monkeying around - after deleting all Emulator Images and Virtual Switches, then repairing the Emulator for Android installation - I stumbled on the likely cause of my problem being the MiFi unit.

I tried different configurations and noticed that if you disable the Ethernet Connection created automatically by windows (it has a description of Remote NDIS based Internet Sharing Device), the Emulators - Android and WindowsPhone now agree to start.

I plan to do more digging but I noticed that HyperV automatically creates virtual switches for all Bluetooth, WiFi and the main Ethernet port but not for the MiFi USB connection. Perhaps that creates some confusion in the underlying HyperV system and getting it out of the way makes everything run fine.

Perhaps others can also share their findings?

Harleigh answered 11/3, 2016 at 13:49 Comment(2)
I agree. I used to disable the Ethernet Connection leaving just the WiFi connectiong before creating the first VM device to get it working. Yesterday just upgraded to Windows 10.0.14372 I notice a new network device for Wireless Hosted Network (they say it is a Windows 7 feature but I don't remember seeing it before) - stopping the service and uninstall the device from Device Manager helped things move along instead of failing at creating the virtual switch. I will try this again a few times and find where to report it to Microsoft. msdn.microsoft.com/en-us/library/dd815243(VS.85).aspxLashonda
@DanDar3, thanks for the added info. I also didn't think of reporting to Microsoft; perhaps it's something they can address for all of us.Harleigh
O
1

I had this problem, removal of virtual switches in Hyper V was not enough. To resolve it I needed to turn off and then turned back on Hyper V itself.

Ostap answered 7/10, 2016 at 20:56 Comment(0)
S
0

I faced the same issue for a week. i followed below steps to fix this, 1) Reset your PC.It will clear all your data and installation file and restore the OS to earlier stage Reset PC 2) Reinstall the visual studio emulator for android 3) Start any profile and it works emulator

Good Luck:)

Shellfish answered 21/5, 2016 at 14:23 Comment(0)
F
0

After formatting my computer I faced the same issue.

The issue was fixed by updating my LAN card drivers, although I don't know why that is.

Francefrancene answered 3/6, 2016 at 15:0 Comment(0)
A
0

I encountered the same problem. It has manifested itself ever since I upgraded to Windows 10 (regardless of the build).

None of the solution stated above seemed to work. However, after deactivating all but one of my network interfaces (I have three : Ethernet x 2 and Wifi), the solution proposed by Ladislav Margai above just worked.

This is what i've done :

1) Repair Android SDK - go to Programs and Features > Microsoft Visual Studio Emulator for Android > Change and hit "Repair"

2) Remove All Hyper-V virtual switches - go to Hyper-V > Virtual switch manager Remove all virtual switches

3) Run XdeCleanup.exe - In my case: "C:\Program Files (x86)\Microsoft XDE\10.0.10240.0"

3 bis) Deactivate all but one of your network interface

4) Launch Android emulator for VS with administrator privileges

5) Activate your network interfaces back

Anstice answered 2/8, 2016 at 13:2 Comment(0)
J
0

I solved the problem simply by running the VS Android Emulator as an admin.

Running Visual Studio as an admin also solved instant crashes that I had on every start.

Jeanajeanbaptiste answered 25/8, 2016 at 17:57 Comment(0)
I
0

I had the same problem to solve it I followed the different step as recommended but nothing, and at the end I simply copied the name of the emulator appears in error message in the log file and following the path to open the .cfg C:\Users\lacike\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\5_KitKat_(4.4)_XXHDPI_Phone and paste this name before device.name

Irrupt answered 2/9, 2016 at 11:42 Comment(0)
D
0

I had hard times setting this up, but after a couple of days of R&D and trying with other people answers I could got this done. Hurray!!!

1) Issue 1: My Visual Studio 2015 Community Edition was halting at 'Preparing virtual machine'. Solution: - After analysis I saw that in my VS -> Tools -> Android -> Android Emulator Manager, my AVD (AVD_GalaxyNexus_ToolsForApacheCordova) was showing a res cross(x). - I corrected this by installing this. This is because my emulator device is: VS Emulator 5-inch KitKat (4.4) XXHDPI Phone for API-19. enter image description here

2) Issue 2: It passed the 'Preparing virtual machine' step, but I faces numerous network creation issue. Solution: This was resolved under the following situation. The emulator always created the virtual switch using my ethernet while I was connected by wifi. So, I switched to a LAN cable provided internet and temporarily disabled my wifi.

Then it was a success. I needed to do the steps mentioned by Ladislav Margai several times in between.

I hope it might help others.

Davita answered 23/9, 2016 at 8:29 Comment(0)
V
0

I tried a bunch of the steps here and they didn't work, so I stepped through this in-depth troubleshooter from Microsoft and found the problem.

https://msdn.microsoft.com/library/windows/apps/jj863509(v=vs.105).aspx

In my case, while Hyper-V had been installed, the Hyper-V Hypervisor (under Hyper-V Platform) had not been installed.

I installed it, re-started, and suddenly the issue was resolved. Can't believe I overlooked it - but maybe someone else has overlooked it too and this helps! :D

Vaporize answered 17/4, 2017 at 16:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.