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 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?
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"
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:)
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.
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.
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.
After hours and hours of research, and applying following steps I finally get it working: