Running an Android emulator on Hyper-V in Windows 10

One of the announcements that caught my attention at this year’s Microsoft Build conference was that it there is now an Android emulator that has been specifically designed to work with Hyper-V. As such, I thought that it might be fun to work through the setup.

Before I begin

Before I get started, I need to point out that the Android emulator currently only works on the Windows 10 version of Hyper-V. Windows Server is not yet supported, although it seems likely that we will see Windows Server support for the emulator in the near future.

Preparing Hyper-V

To run the Android emulator, you will need to install both Hyper-V and the Windows Hypervisor Platform. In case you are not familiar with the Windows Hypervisor Platform, it is a component that allows third-party virtualization stacks and applications to be used.

To install the required components, open Control Panel and then go to Programs, followed by Programs and Features. Next, click the option to turn Windows features on or off. Now, select the options for both Hyper-V and the Windows Hypervisor Platform. You can see the Windows Hypervisor Platform shown in the image below.
Android emulator

Install the Visual Studio Preview

To use the Android emulator, you are going to need Visual Studio installed on your Windows 10 machine. Because the emulator was only recently introduced, the current release of Visual Studio will not work with the emulator. That being the case, you will have to download and install Visual Studio 2017 version 15.8 Preview 1 or higher. You can download the preview here.

The process of installing the Visual Studio preview is really straightforward, although it does require a lot of disk space (nearly 15GB). The one thing that you will have to do during the installation process is to install the Mobile Development with .NET workload. If you’re not familiar with Visual Studio, the installer prompts you to choose which workloads you want to install. Mobile Development With .NET is one of the choices, as shown in the image below. Just make your selection and click Install.

Android emulator
When you click Install, the installation process will begin. Depending on the speed of your PC and the amount of Internet bandwidth that you have available, this can take a while. You can see what the install process looks like below. Incidentally, you will have to reboot once the installation process finishes.

Android emulator

Verify your Android emulator version

If you look back at the previous screen captures, you will notice that an Android emulator gets installed along with the Mobile Development With .NET workload. However, there is a possibility that the workload does not contain the correct version of the emulator. The only way to know for sure is to check Visual Studio and see which emulator version is currently installed.

To do so, launch Visual Studio, and then click on the Tools menu and select the Android command, followed by the Android SDK Manager command. This will cause the Android SDKs and Tools dialog box to open. Go to the dialog box’s Tools tab and locate the Android Emulator. As you can see in the image below, the current version is 27.1.12. At the time this article was written, the current version was 27.2.7, which means that we need to download the newer version and perform an update.

Android emulator

To do so, download the Xamarin for Visual Studio update. Keep in mind that I am working with a preview release, so it is possible that the download link could change. When the download completes, open the file and you will be taken to a window like the one shown below, prompting you to install the update. Make sure that the Visual Studio preview checkbox is selected and click Install.

Android emulator

When the installation completes, close the installer and go back into Visual Studio. Next, go back to the Tools tab on the Android SDKs and Tools window that I showed you earlier. Now when you look at the Android Emulator, the version number should still be the same, but the Status column should indicate that an update is available. Go ahead and click on the Updates Available button shown below.

Android emulator
Click on the button in the lower left corner to install the updates.

Running the emulator

To run the Android emulator, open a Command prompt window and navigate to C:\Program Files (x86)\Android\Android-sdk\emulator. Next, you will need to retrieve the names of the AVDs that are installed. To do so, enter the following command:

Emulator -list-avds

You can see what this looks like in the image below:

Android emulator

Now it’s time to launch the emulator. Remember that we want to run this on Hyper-V, so we will need to specify the Windows Hypervisor Platform as a feature within the command. We will also need to include the name of the AVD and the partition size. The command syntax looks like this:

Emulator -avd <the name of your AVD> -partition-size 512 -feature WindowsHypervisorPlatform

In my case, the exact command that I am using to launch the emulator is:

Emulator -avd Android_Accelerated_X86_Oreo -partition-size 512 -feature WindowsHypervisorPlatform

There are a couple of things that you need to know about using this command. First, the command line switches need to be entered in lower case if they are to work properly. Second, it is normal to get a couple of warnings or errors the first time that you run the emulator. Here is what the launch looks like in action.

Android emulator
If you have entered the command correctly, the emulator should open, as shown below.

Android emulator

Although setting up the Android emulator involves a bit of work, subsequent uses should be relatively simple. You can even create a batch file or a shortcut to make it easier to launch the emulator in the future.

About The Author

10 thoughts on “Running an Android emulator on Hyper-V in Windows 10”

  1. When I try to run the emulator per your instructions, I get:

    PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT

    What should this var be set to ?

  2. Gitte Engelsholm

    Hi. I have been running UiTEst from VS without problems so fare using Intel HAXM accelerator. Today I decided to upgrade VS and switch from HAXM to Hyper-V (following ; and uninstalling HAXM). I can start from within VS the Android Device Manager and the same emulated device as previously, but my UiTest take less than a second from ‘Run teste started’ to ‘Run test finished’ VS Output.
    I just tried your description on how to start the emulator from CommandPromt; The emulator do start but I get below result.
    I would appreciate any help emulator -avd my_nexus6p_nougat71 -partition-size 512 -feature WindowsHypervisorPlatform
    Windows Hypervisor Platform accelerator is operational
    UpdateLayeredWindowIndirect failed for ptDst=(3792, 442), size=(335×104), dirty=(335×187 0, 0) (A device attached to the system is not functioning.)

  3. Yeppy, spent the day doing this. Prior to that was the 3 day install/re-install of VS 2017 Community 15.9; installed old SKD’s, must been a bad link. So far so good, have templates after another day of modify/installing the workloads for ASP and mobile development. Now the hyper-v is not working error when starting the emulator; will there be an article on that? LOL..

  4. I use hyper-v to run it fine but when download some app from google play store and run it then

    Event said +1

    Emulator: glTexImage2D: got err 🙁 0x500 internal 0x1908 format 0x1908 type 0x8d61

    1. I am pretty sure that the emulator is designed primarily as a development tool. It may not support Google Play apps.

  5. 100% it supports Google Play apps. If you’ve installed the Android Device Manager (I’m using the one that comes with Visual Studio 2019) you’ll be able to create an emulated android device with google play store functionality. (In fact to develop for some features, it’s a prerequisite).
    After setting up the emu correctly to take advantage of Hyper-V, and having previously had it setup with intel haxm, AND have microsoft recommend hyper-v WHPX, and everyone badgering on about how much better Hyper-V is going to be….

    Intel HAXM is way faster, not just a little bit, a LOT, I’m going to put a subjective estimate in here and say that HAXM is 2 to 3 times faster than Hyper-V. You’ll go from clunky screen updates in Hyper-V to super smooth animations and scrolling in HAXM.

    Anyway, that sucks, because in order to have HAXM running you can’t have Hyper-V, and I need Hyper-V to run other machines at the same time as my android emu.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top