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 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.
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.
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.
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.
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.
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.
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.
Click on the button in the lower left corner to install the updates.
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:
You can see what this looks like in the image below:
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.
If you have entered the command correctly, the emulator should open, as shown below.
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.
Two of the main factors that affect the total cost of an organization’s Microsoft 365…
Samsung rolled out the all-new Galaxy Z Fold 2, Note 20, Note 20 Ultra handsets…
SAN and NAS provide dedicated storage for a group of users using completely different approaches…
In many companies, Generation 1 virtual machines have been superseded by Gen 2 VMs. But…
With these free VPNs based in Hong Kong, you may not be paying any money…
These Azure DevOps tips and tricks come fresh from the field where they have been…