Hardware Acceleration for Emulator Performance
This article explains how to use your computer's hardware acceleration features to maximize Google Android Emulator performance.
Visual Studio makes it easier for developers to test and debug their Xamarin.Android applications by using the Google Android Emulator in situations where an Android device is unavailable or impractical. However, the Android emulator runs too slowly if hardware acceleration is not available on the computer that runs it. You can drastically improve the performance of the Android emulator by using special virtual device images that target x86 hardware in conjunction with one of two virtualization technologies:
Microsoft's Hyper-V and the Hypervisor Platform. Hyper-V is a virtualization feature of Windows that makes it possible to run virtualized computer systems on a physical host computer. This is the recommended virtualization technology to use for accelerating the Google Android Emulator. To learn more about Hyper-V, see Hyper-V on Windows 10.
Intel's Hardware Accelerated Execution Manager (HAXM). HAXM is a virtualization engine for computers running Intel CPUs. This is the recommended virtualization engine for computers that are unable to run Hyper-V.
The Google Android Emulator will automatically make use of hardware acceleration if the following criteria are met:
Hardware acceleration is available and enabled on the development computer.
The emulator is running an emulator image specifically created for an x86-based virtual device.
For information about launching and debugging with the Android Emulator, see Debugging with the Google Android Emulator.
Hyper-V support is currently in Preview.
Developers who are using Windows 10 (April 2018 Update or later) are strongly encouraged to use Microsoft's Hyper-V to accelerate the Google Android Emulator. To use the Google Android Emulator with Hyper-V:
Update to Windows 10 April 2018 Update (build 1803) or later. To verify which version of Windows is running, click in the Cortana search bar and type About. Select About your PC in the search results. Scroll down in the About dialog to the Windows specifications section. The Version should be at least 1803:
Enable the Windows Hypervisor Platform. In the Cortana Search bar, type Turn Windows features on or off. Scroll down in the Windows Features dialog and ensure that Windows Hypervisor Platform is enabled:
Enabling Windows Hypervisor Platform automatically enables Hyper-V. It is a good idea to restart Windows after making this change.
Install Visual Studio 15.8 Preview 1 or later. This version of Visual Studio provides IDE support for running the Google Android Emulator with Hyper-V.
Install the Google Android emulator package 27.2.7 or later. To install this package, navigate to Tools > Android > Android SDK Manager in Visual Studio. Select the Tools tab and ensure that the Android Emulator version is at least 27.2.7. Also ensure that the Android SDK Tools version is 26.1.1 or later:
If the emulator version is at least 27.2.7 but less than 27.3.1, the following workaround is required to use Hyper-V:
In the C:\Users\username\.android folder, create a file called advancedFeatures.ini (if it doesn't already exist).
Add the following line to advancedFeatures.ini:
WindowsHypervisorPlatform = on
If you are unable to update to emulator version 27.2.7 or later after updating to a Visual Studio preview, you may have to directly install the preview installer to enable newer emulator versions.
Performance may be reduced when using certain Intel and AMD-based processors.
Android application may take an abnormal amount of time to load on deployment.
MMIO access error may intermittently prevent a boot of the Android emulator. Restarting the emulator should resolve this.
HAXM is a hardware-assisted virtualization engine (hypervisor) that uses Intel Virtualization Technology (VT) to speed up Android app emulation on a host machine. Using HAXM in conjunction with Android x86 emulator images provided by Intel allows for faster Android emulation on VT-enabled systems.
If you are developing on a machine with an Intel CPU that has VT capabilities, you can take advantage of HAXM to greatly speed up the Google Android Emulator (if you're not sure whether your CPU supports VT, see Does My Processor Supports Intel Virtualization Technology?).
You can't run a VM-accelerated emulator inside another VM, such as a VM hosted by VirtualBox, VMWare, or Docker. You must run the Google Android emulator directly on your system hardware.
Before using the Google Android Emulator for the first time, it's a good idea to verify that HAXM is installed and available for the Google Android Emulator to use.
Verifying HAXM Installation
You can check to see if HAXM is available by viewing the Starting Android Emulator window while the emulator starts. To start the Google Android Emulator, do the following:
Launch the Android Device Manager by clicking Tools > Android > Android Device Manager:
If you see a Performance Warning dialog similar to the following, then HAXM is not yet installed or configured properly on your computer:
If a Performance Warning dialog like this is shown, see Performance Warnings to identify the cause and resolve the underlying problem.
Select an x86 image (for example, VisualStudio_android-23_x86_phone) and click Start:
Watch for the Starting Android Emulator dialog window while the emulator starts up. If HAXM is installed, you will see the message, HAX is working and emulator runs in fast virt mode as shown in this screenshot:
If you do not see this message, then HAXM is probably not installed. For example, here is a screenshot of a message you may see if HAXM is not available:
If HAXM is not available on your computer, use the steps in the next section to install HAXM.
If the emulator does not start, HAXM may have to be installed manually. HAXM install packages for both Windows and macOS are available from the Intel Hardware Accelerated Execution Manager page. Use the following steps to download and install HAXM manually:
From the Intel website, download the latest HAXM virtualization engine installer for Windows. The advantage of downloading the HAXM installer directly from the Intel website is that you can be assured of using the latest version.
Alternately, you can use the SDK Manager to download the HAXM installer (In the SDK Manager, click Tools > Extras > Intel x86 Emulator Accelerator (HAXM installer)). The Android SDK normally downloads the HAXM installer to the following location:
C:\Program Files (x86)\Android\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager
Note that the SDK Manager does not install HAXM, it merely downloads the HAXM installer to the above location; you still have to launch it manually.
Run intelhaxm-android.exe to start the HAXM installer. Accept the default values in the installer dialogs:
Hardware Acceleration and AMD CPUs
Because Google's Android emulator currently supports AMD hardware acceleration only on Linux, hardware acceleration is not available for AMD-based computers running Windows.