Friday, September 11, 2015

Using the Visual Studio Android emulator inside VMWare

I do my development in Virtual machines.  It makes it much easier to to back up and transfer my dev environments.  However not everything works inside a virtual machine :(.  Emulator that themselves rely on a virtual machine are problematic.

When Visual Studio 2015 was released, I built a new VM and installed everything.  VS2015 worked fine but the new shiny Android emulator wasn't so happy.

The first error was around Hyper-V.

Visual Studio Emulator for Android
The emulator is unable to verify that the virtual machine is running:
Something happened while starting a virtual machine: 'VS Emulator 5-inch KitKat (4.4) XXHDPI Phone.bob' failed to start. (Virtual machine ID 889F3EA2-7B0E-4873-9180-C765E4293D4E)
The Virtual Machine Management Service failed to start the virtual machine 'VS Emulator 5-inch KitKat (4.4) XXHDPI Phone.bob' because one of the Hyper-V components is not running (Virtual machine ID 889F3EA2-7B0E-4873-9180-C765E4293D4E).

This a fairly common error and once that is easy to fix.

  1. Open the .vmx file in notepad and ad the following lines:
    hypervisor.cpuid.v0 = "FALSE"
    mce.enable = "TRUE"
    vhu.enable = "TRUE"
  2. Run the VM.  Go to "Programs and Features" and ensure that Hyper-V is installed



Running the emulator now gives a completely different error.  Yay, progress.
Visual Studio Emulator for Android
An OpenGL error has occurred:
Failed to create Context 0x3005
The emulator will now shut down.

There are multiple ways to fix this:


Either way works:











2 comments:

Anonymous said...

I would like to run Delphi android fmx project in the Visual Studio emulator. Have you tried it?.

Regards.

Sean said...

Sorry, I haven't