Running android emulator with Azure windows 10


I am trying to run an android emulator on an azure VM running windows, Windows 10 Pro version 1809 - But I am getting the following error message running the android emulator:

C:\Program Files (x86)\Android\android-sdk\emulator>emulator -AVD androidemulatorapi28 emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure the Windows Hypervisor Platform (WHPX) is properly installed and usable. CPU acceleration status: HAXM is not installed on this machine

The hyper-v is enabled:

enter image description here

And Windows Hypervisor Platform as well:

enter image description here

The size of the VM is D2_v3 and Dv3 - series is supposed to support Nested Virtualization. Here, here and here are claims about it being so and that android emulator functions. And as I far as I have understood:

enter image description here part of Dv3 series.

What could be the problem?

I am able to run an Ubuntu VM in Hyper-V of the Azure Windows VM.

Disabling Hyper-V and Windows Hypervisor Platform, installing HAXM and running I get this error:

enter image description here

According to the writer of this medium article and this StackOverflow discussion - A special custom implementation of OpenGL is necessary - because the particular azure VM size doesn't come with a GPU. However, following the steps of the article I get another type of crash - when using the Mesa3D LLvmpip version of opengl32.dll from the authors Github repo, replacing the OpenGL file in system32 and running the android emulator:

enter image description here

I found there was a gihub repo - distributing Mesa3D and LLvmpip - downloading mesa3d-19.1.3-release-mingw.exe and running the cmd file:

enter image description here

There is the following message in cmd:

This deployment utility targets systems without working GPUs and any use case where hardware-accelerated OpenGL is not available. This mainly covers virtual machines in cloud environments and RDP connections. It can be used to replace Microsoft Windows inbox OpenGL 1.1 software render driver with Mesa3D soft pipe, llvmpipe or SWR driver.

...which seems to be a fit for the driver rendering problem.

I was able to git rid of all cmd warnings and error by-avd myandroidemulatorapi28, and any with of following two flags -gpu angle_indirect or -gpu swiftshader_indirect. And set QEMU_AUDIO_DRV=none before running it. The GUI message about the driving issue still comes up and there is a black screen.

According to the owner of the mesa-dist-win GitHub repo - he could reproduce the GUI message diver complaint and still run the emulator successfully - when imitating the state of a VM with his machine.


Note: This is not a solution, this is for sharing details of what I learned after trying out around 10-20 ways:

  • To enable virtualization in azure VDI, you need to enable Hyper-V feature.
  • After that you can see in your task manager->Performance that the virtualization is set to true.
  • If not, try enabling it from command prompt. bcdedit /set hypervisorlaunchtype auto

  • After that virtualization is enabled.

  • Now, you won't be able to install Intel HAXM, as there is a race condition between Hyper-V and Intel HAXM for virtualization.
  • So, Without Intel HAXM, AVD won't run.

  • Without Enabling Virtualization with Hyper-V, there will be just black screen in AVD, and it won't boot.

So, I believe there is no solution to this problem until now, I have search everything on google, stackoverflow. If someone finds a solution, please post it over here.