James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


Twitter


Android Emulators On Hyper-V Are Pretty Awesome

James MontemagnoJames Montemagno

I have been a mobile developer for 7 years now and since the day I started one of my largest complaints has been the Android emulator. From the very start we had just ARM emulators that were a complete joke to work with as they moved at a snail's pace. From there a bunch of companies attempted to fix the problem by using custom built solutions on top of Virtual Box or Hyper-V. Google has done a lot of work in the last few years to improve the Android emulators with Quick Boot, more customization and hardware support, but being able to run them fast has still been a pain point.

Intel HAXM... So Close

Intel nearly saved the day with HAXM that runs Android x86 emulator images on Intel VT. This actually works amazing on macOS as every device essentially has an Intel chip and doesn't have conflicts with a core virtualization engine (hypervisor). If you are like me and develop every day on a Windows machine then you know that HAXM is great, but only if you have the ideal setup:

  • AMD Processor: No HAXM
  • Want to run Hyper-V: No HAXM
  • PC doesn't support Intel VT: No HAXM
  • Want to do Docker: No HAXM

Even installing HAXM is very tricky and requires reboots and toggles sometimes in the BIOS, which is never fun.

The Solution: Windows Hypervisor Platform

In the Windows 2018 April Update (build 1803) something magical happened. The mobile developer tools team (aka Xamarin team) worked with the Hyper-V team to extend Hyper-V for the first time to be able to run Google's official Android x86 emulator images natively on Hyper-V instead of on Intel's HAXM. This means that for the first time if you have an AMD Processor, have Hyper-V on, or wanted to do Docker work you can run Android emulators pretty fast. Here is me running an Android emulator on my Surface Book 2 with the new Hypervisor Platform:

Power Up Your Android Emulator

Checkout the full documentation to learn the small details on setup, but in general it is as simple as upgrading your Android SDK and Emulator in the Android SDK Manager:

04-sdk-manager-w158-sml

Then just turn on Hyper-V and the Windows Hypervisor Platform (if you don't see this and are on October's update don't worry it is now bundled into Hyper-V itself).

03-hyper-v-settings-w158-sml

After a quick reboot, Hyper-V is ready to roll on your machine and the emulators should boot up pretty quick. I will say that YMMV on these Android emulators as this is the first release with support for Windows Hypervisor Platform. There is a crazy amount of configurations out there of Windows PCs and I am sure they would be interested to know if you are experiencing super slow emulators after everything is enabled so let them know on the Visual Studio Developer Community. Cheers!


Tags



Live, Love, Bike, and Code

Checkout my monthly newsletter that you should subscribe to!

Comments