Android Emulator Hardware Acceleration

The Google Android Emulator is prohibitively slow without hardware acceleration. It is possible to drastically improve the performance of the Google Android Emulator using special emulator hardward images that target x86 hardware and one of two virtualization technologies:

  1. Microsoft's Hyper-V and the Hypervisor Platform – Hyper-V is a virtualization component that is available on Windows 10 that enables running virtualized computer systems on top of a physical host. This is the recommended virtualization technology for the accelerated Google Android Emulator images. To learn more about Hyper-V, please consult the Hyper-V on Windows 10 guide.
  2. Intel's Hardware Accelerated Execution Manager (HAXM) – this is a virtualization engine for computers running Intel CPUs. This is the recommended virtualization engine for developers that are unable to use Hyper-V.

The Android SDK Manager will automatically make use of hardware acceleration when it is available it is running an emulator image specifically for an x86-based virtual device (as described in Configuration and Use).

Hyper-V Overview

Note

Hyper-V support is currently in Preview.

Developers who are using Windows 10 (April 2018 Update) are strongly encouraged to use Microsoft's Hyper-V. The Visual Studio Tools for Xamarin make it easy for developers to test and debug their Xamarin.Android applications in situations where an Android device is unavailable or impractical.

To get started with using Hyper-V and the Google Android Emulator:

  1. Update to Windows 10 April 2018 Update (build 1803) – To verify what 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:

    Windows specifications

  2. Enable both Hyper-V and 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 the Windows Hypervisor Platform is enabled.

    Hyper-V and Windows Hypervisor Platform enabled

    It may be necessary to reboot Windows after enabling Hyper-V and the Windows Hypervisor Platform.

  3. Install Visual Studio 15.8 Preview 1 or later – This version of Visual Studio provides IDE support for starting the Google Android Emulator with Hyper-V support.

  4. 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 the Android Emulator component is at least of version 27.2.7.

    Android SDKs and Tools dialog

  5. If the Android Emulator version is less than 27.3.1, apply the additional workaround step explained in Known Issues (next).

Known Issues

  • 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:

    1. In the C:\Users\username\.android folder, create a file called advancedFeatures.ini if it doesn't already exist.
    2. Add the following line to advancedFeatures.ini:
      WindowsHypervisorPlatform = on
      
  • 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 Overview

HAXM is a hardware-assisted virtualization engine (hypervisor) that uses Intel Virtualization Technology (VT) to speed up Android app emulation on a host machine. In combination with Android x86 emulator images provided by Intel and the official Android SDK Manager, HAXM 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 Determine If Your Processor Supports Intel Virtualization Technology).

Note

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 you use the Google Android Emulator for the first time, it's a good idea to verify that HAXM is installed and available to the Google Android Emulator.

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:

  1. Launch the Android Emulator Manager by clicking Tools > Android > Android Emulator Manager:

    Android Emulator Manager menu item location

  2. If you see a Performance Warning dialog similar to the following, then HAXM is not yet installed or configured properly on your computer:

    Performance Warning dialog that HAXM is not ready

    If a Performance Warning dialog like this is shown, see Performance Warnings to identify the cause and resolve the underlying problem.

  3. Select an x86 image (for example, VisualStudio_android-23_x86_phone), click Start, then click Launch:

    Starting the Google Android Emulator with a default virtual device image

  4. 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:

    HAXM is shown as available in the Starting Android Emulator dialog

    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:

    HAXM is not available on this machine

    If HAXM is not available on your computer, use the steps in the next section to install HAXM.

Installing 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:

  1. 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.

  2. Run intelhaxm-android.exe to start the HAXM installer. Accept the default values in the installer dialogs:

    Intel Hardware Accelerated Execution Manager Setup window

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.