Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 434
Ladislav Margai Avatar asked Jul 24 '15 14:07

Ladislav Margai


People also ask

How do I enable Android emulator in Visual Studio?

Just open up the Visual Studio Emulator for Android entry in your Start Menu, hit play, and the emulator is ready to debug from any IDE. Download the standalone emulator today!

Why is AVD not working?

Android Virtual Devices fail to launch on ChromeOS On ChromeOS, Android Virtual Devices (AVDs) might fail to launch because the libnss3 dependency is missing. To launch the AVDs successfully, run sudo apt install libnss3 to manually install the libnss3 library.

How do I enable emulator in VS code?

Step 1: Go to the Extensions button on VSCode and search for Android and iOS Emulator and install it. Note: Change the Emulator path windows address based on the location of the emulator file on your PC but make the Emulator path as default it would be given as default by the VSCode.

Can I run Visual Studio on Android?

The Visual Studio Emulator for Android can be installed under “Individual components” with Visual Studio 2022.


2 Answers

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

like image 128
Ladislav Margai Avatar answered Oct 15 '22 02:10

Ladislav Margai


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"

like image 33
John Kemnetz Avatar answered Oct 15 '22 02:10

John Kemnetz