Configure hardware acceleration for the Android Emulator

The emulator runs best if it can use your machine’s hardware, such as the CPU, GPU, and modem, rather than running as pure software. The ability to use your machine’s hardware to improve performance is called hardware acceleration.

The emulator can use hardware acceleration to improve your experience in two main ways:

  • Graphics acceleration for improved screen rendering
  • Virtual machine (VM) acceleration for improved execution speed

Hardware acceleration is enabled by default on most machines. If it isn't enabled on your machine, this page describes how you can configure graphics and virtual machine (VM) acceleration to get higher performance from the emulator.

Configure graphics acceleration

Graphics acceleration uses your computer's hardware (typically the GPU) to make screen rendering faster. Android devices use OpenGL for Embedded Systems (OpenGL ES or GLES) for rendering both 2D and 3D graphics on the screen.

When you create an Android Virtual Device (AVD) in the AVD Manager, you can specify whether the emulator uses hardware or software to emulate the GPU of the AVD. Hardware acceleration is recommended and is typically faster. However, you might need to use software acceleration if your computer uses graphics drivers that aren't compatible with the emulator.

By default, the emulator decides whether to use hardware or software graphics acceleration based on your computer setup. If your GPU hardware and drivers are compatible, the emulator uses the GPU. Otherwise, the emulator uses software acceleration (using your computer's CPU) to simulate GPU processing.

If you start the emulator from the command line, you can override the graphics acceleration setting in the AVD for that virtual device instance.

Requirements

To use graphics acceleration, your development environment must have the following:

  • SDK Tools: Latest release recommended (version 17 minimum)
  • SDK Platform: Latest release recommended (Android 4.0.3, Revision 3, minimum)

Configure graphics acceleration in the AVD Manager

To configure graphics acceleration for an AVD, follow these steps:

  1. Open the AVD Manager.
  2. Create a new AVD or edit an existing AVD.
  3. In the Verify Configuration window, find the Emulated Performance section.
  4. Select a value for the Graphics: option.
  5. Click Finish.

Configure graphics acceleration from the command line

To specify a graphics acceleration type when you run an AVD from the command line, include the -gpu option, as shown in the following example:

emulator -avd avd_name -gpu mode [{-option [value]} ... ]

The value of mode can be set to one of the following options:

  • auto: Let the emulator choose between hardware or software graphics acceleration based on your computer setup.
  • host: Use the GPU on your computer for hardware acceleration. This option typically provides the highest graphics quality and performance for the emulator. However, if your graphics drivers have issues rendering OpenGL, you might need to use the swiftshader_indirect or angle_indirect options.
  • swiftshader_indirect: Use a Quick Boot-compatible variant of SwiftShader to render graphics using software acceleration. This option is a good alternative to host mode if your computer can't use hardware acceleration.
  • angle_indirect: (Windows only) Use a Quick Boot-compatible variant of ANGLE Direct3D to render graphics using software acceleration. This option is a good alternative to host mode if your computer can't use hardware acceleration. In most cases, ANGLE performance is similar to using host mode because ANGLE uses Microsoft DirectX instead of OpenGL.

    On Windows, Microsoft DirectX drivers typically have fewer issues than OpenGL drivers. This option uses Direct3D 11 and requires Windows 10, Windows 8.1, or Windows 7 SP1 with the Windows 7 Platform Update.

  • guest: Use guest-side software rendering. This option provides the lowest graphics quality and performance for the emulator.

The following mode options are deprecated:

  • swiftshader: Deprecated in version 27.0.2. Use swiftshader_indirect instead.
  • angle: Deprecated in version 27.0.2. Use angle_indirect instead (Windows only).
  • mesa: Deprecated in version 25.3. Use swiftshader_indirect instead.

Enable Skia rendering for Android UI

When using images for API level 27 or higher, the emulator can render the Android UI with Skia. Skia helps the emulator render graphics more smoothly and efficiently.

To enable Skia rendering, use the following commands in the adb shell:

su
setprop debug.hwui.renderer skiagl
stop
start

Configure VM acceleration

VM acceleration uses your computer's processor to significantly improve the execution speed of the emulator. A tool called a hypervisor manages this interaction using virtualization extensions that your computer's processor provides. This section outlines the requirements for using VM acceleration and describes how to set up VM acceleration on each operating system.

General requirements

To use VM acceleration with the emulator, your computer must meet the general requirements in this section. Your computer also needs to meet other requirements that are specific to your operating system.

Development environment requirements

To use VM acceleration, your development environment must meet the following requirements:

  • SDK Tools: Minimum version 17; recommended version 26.1.1 or later
  • AVD: Required Android version is described in the table that follows.

    CPU Architecture System Image Requirement
    X86_64 x86 or x86_64 system images for Android 2.3.3 (API level 10) and higher
    ARM64 arm64-v8a system images for Android 5.0 (API level 21) and higher

Virtualization extension requirements

In addition to the development environment requirements, your computer's processor must support virtualization extensions. Supported processors are:

  • Intel Processors with Intel Virtualization Technology (VT-x, vmx)
  • AMD Processors with AMD-V (SVM)
  • Apple silicon

Additional Requirements for Intel and AMD processors:

Second-level address translation (Intel EPT or AMD RVI) is required for Intel and AMD processors. Most modern Intel and AMD processors support second-level address translation. Only the first-generation Intel or AMD processors offering virtualization extensions may not have second-level page translations.

If you're unsure whether your processor supports the required extensions, check the specifications for your processor on the manufacturer's site. If your processor doesn't support these extensions, then you can't use VM acceleration.

Restrictions

VM acceleration has the following restrictions:

  • You can't run a VM-accelerated emulator inside another VM, such as a VM hosted by VirtualBox, VMWare, or Docker. You must run a VM-accelerated emulator directly on your host computer.
  • Depending on your operating system and hypervisor, you may not run software that uses another virtualization technology at the same time that you run a VM-accelerated emulator. Examples of the such software include but are not limited to virtual machine solutions, certain antivirus programs and a few anti-cheat solutions. The situation is mostly observed on Windows with Hyper-V off. Most of such software can coexist with the android emulator without any problems. But when conflicts occur, it is recommended not to run the VM-accelerated emulator at the same time with such software.

About hypervisors

VM acceleration requires a hypervisor, a tool that uses virtualization extensions provided by your computer's processor.

Without a hypervisor and VM acceleration, the emulator must translate the machine code from the VM block by block to conform to the architecture of the host computer. This process can be quite slow. With a hypervisor, when the VM and the architecture of the host computer match, the emulator can run code directly on the host processor using the hypervisor. This improvement drastically increases both the speed and performance of the emulator.

The hypervisor that works best for you depends on your computer's operating system and configuration. For more information, see one of the following sections:

Check whether a hypervisor is installed

You can use the emulator -accel-check command-line option to check whether a hypervisor is currently installed on your computer.

The following examples show how to use the emulator accel-check option. In each example, Sdk is the location of the Android SDK:

Windows:

c:\Users\janedoe\AppData\Local\Android> Sdk\emulator\emulator -accel-check
accel:
0
AEHD (version 2.0) is installed and usable.
accel
There are multiple hypervisor choices on Windows. So what you see might be different from the example here. For example, you may see one of the following keywords in the message: GVM(former name of AEHD), WHPX, HAXM.

macOS:

janedoe-macbookpro:Android janedoe$ ./Sdk/emulator/emulator -accel-check
accel:
0
Hypervisor.Framework OS X Version 13.2
accel

Linux:

janedoe:~/Android$ ./Sdk/emulator/emulator -accel-check
accel:
0
KVM (version 12) is installed and usable.

Configure VM acceleration on Windows

VM acceleration on Windows can use one of three hypervisors:

  • The Android Emulator hypervisor driver (AEHD)
  • The Windows Hypervisor Platform (WHPX)
  • The Intel Hardware Accelerated Execution Manager (HAXM)

Choose a hypervisor on Windows

This section shows the criteria to determine which hypervisor to use. The process to configure VM acceleration using each hypervisor is described in the sections that follow.

Starting from emulator 33.x.x.x, HAXM is deprecated as Intel discontinues development of HAXM. The Android Emulator hypervisor driver (AEHD) replaces Intel HAXM on Intel Processors.

Criteria (emulator 33.x.x.x and higher) Hypervisor
You do not need to run Hyper-V at the same time as the Android Emulator. Use Android Emulator hypervisor driver.
You do need to run Hyper-V at the same time as the Android Emulator. Use WHPX.

For emulator 32.x.x.x and lower, please continue to follow the old criteria to determine which hypervisor to use.

Criteria (emulator 32.x.x.x and lower) Hypervisor
You have an Intel processor and do not need to run Hyper-V at the same time as the Android Emulator. Use Intel HAXM.
You have an AMD processor and do not need to run Hyper-V at the same time as the Android Emulator. Use Android Emulator hypervisor driver.
You have an Intel or AMD processor and do need to run Hyper-V at the same time as the Android Emulator. Use WHPX.

Configure VM acceleration using Android Emulator hypervisor driver (AEHD) on Windows

Before you can install and use the Android Emulator hypervisor driver, your computer must meet the following requirements:

  • Intel or AMD processors with virtualization extension.
  • 64-bit Windows 11, Windows 10, Windows 8, or Windows 7 (32-bit Windows is not supported)

  • On Windows 11, Windows 10 or Windows 8, you must turn off Hyper-V in the Windows Features Dialog.

On AMD Processors, the Android Emulator hypervisor driver can be installed via the SDK Manager in Android Studio 4.0 Canary 5 or later.

On Intel Processors, the Android Emulator hypervisor driver can be installed via the SDK Manager in Android Studio Flamingo or later.

To install from the SDK Manager, follow these steps:

  1. Select Tools > SDK Manager.
  2. Click the SDK Tools tab and select Android Emulator hypervisor driver.
  3. Click OK to download and install the Android Emulator hypervisor driver.
  4. After installation, confirm that the driver is operating correctly using the following command-line command:

    AEHD 2.1 and higher

    sc query aehd
    

    A status message includes the following information:

    SERVICE_NAME: aehd
           ...
           STATE              : 4  RUNNING
           ...
    

    The following error message means either that virtualization extension is not enabled in your BIOS or that Hyper-V is not disabled:

    SERVICE_NAME: aehd
           ...
           STATE              : 1  STOPPED
           WIN32_EXIT_CODE    : 4294967201 (0xffffffa1)
           ...
    

    AEHD 2.0 and lower

    sc query gvm
    

    A status message includes the following information:

    SERVICE_NAME: gvm
           ...
           STATE              : 4  RUNNING
           ...
    

    The following error message means either that virtualization extension is not enabled in your BIOS or that Hyper-V is not disabled:

    SERVICE_NAME: gvm
           ...
           STATE              : 1  STOPPED
           WIN32_EXIT_CODE    : 4294967201 (0xffffffa1)
           ...
    

The Android Emulator hypervisor driver can also be downloaded and installed from GitHub. After unpacking the driver package, run silent_install.bat at a command line with administrator privileges.

Uninstall Android Emulator hypervisor driver using the following commands at a command line with administrator privileges:

AEHD 2.1 and higher

   sc stop aehd
   sc delete aehd

AEHD 2.0 and lower

   sc stop gvm
   sc delete gvm

Configure VM acceleration using Intel HAXM on Windows

Before you can install and use Intel HAXM, your computer must meet the following requirements:

  • Intel processor with Virtualization Technology (VT-x), Intel EM64T (Intel 64) features, and Execute Disable (XD) Bit functionality enabled
  • 64-bit Windows 11, Windows 10, Windows 8, or Windows 7 (or 32-bit version of the operating system on a 64-bit processor)
  • On Windows 11, Windows 10 or Windows 8, you must turn off Hyper-V in the Windows Features Dialog.

To install the Intel HAXM driver, follow these steps:

  1. Open the SDK Manager.
  2. Click the SDK Update Sites tab and select Intel HAXM.
  3. Click OK.
  4. After the download finishes, run the installer.

    Typically, you can find the installer in the following location: sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe

  5. Use the wizard to complete the installation.

  6. After installing Intel HAXM, confirm that the virtualization driver is operating correctly using the following command-line command:

    sc query intelhaxm
    

    A status message includes the following information:

    SERVICE_NAME: intelhaxm
           ...
           STATE              : 4  RUNNING
           ...
    

For more information, see the installation instructions for Intel HAXM on Windows.

To uninstall Intel HAXM, use either the installer or the Windows Control Panel. Before you uninstall Intel HAXM, shut down any running x86 emulators.

Configure VM acceleration using Windows Hypervisor Platform

Before you can enable WHPX, your computer must meet the following requirements:

  • Intel processors: Support for Virtualization Technology (VT-x), Extended Page Tables (EPT), and Unrestricted Guest (UG) features. VT-x must be enabled in your computer's BIOS settings.
  • AMD processors: AMD Ryzen processor recommended. Virtualization or SVM must be enabled in your computer's BIOS settings.
  • Android Studio 3.2 Beta 1 or higher
  • Android Emulator version 27.3.8 or higher
  • Windows 10 or higher

To install WHPX on Windows, follow these steps:

  1. From the Windows desktop, right-click the Windows icon and select Apps and features.
  2. Under Related settings, click Programs and Features.
  3. Click Turns Windows Features on or off.
  4. Select Windows Hypervisor Platform.

  5. Click OK.

  6. Once the installation has finished, restart your computer.

Double-check when disabling Hyper-V

Hyper-V must be disabled to use the Android Emulator hypervisor driver or Intel HAXM. However, deselecting "Hyper-V" in the Windows Features Dialog does not guarantee that Hyper-V is disabled.

Quite a few features in Windows 10 enable Hyper-V implicitly. Users might not even know Hyper-V is activated when they enable one of these features. These features include:

  • Virtual Machine Platform
  • Windows Hypervisor Platform
  • Windows Sandbox
  • Core Isolation
  • Credential Guard

Additionally, Windows Subsystem for Linux version 2 requires Virtual Machine Platform, meaning that it implicitly requires Hyper-V. This list is not exhaustive; file a bug if you find an item that should be included here.

Double-check that the features listed are also disabled when disabling Hyper-V. Reference Microsoft documentation and the examples below to find out how each individual feature can be disabled.

Some platforms fail to immediately disable Hyper-V when it is switched off. When this occurs, there is no error returned by the Windows OS and Hyper-V appears disabled in the Windows Features Dialog. Please file a bug on Microsoft's issue tracker when this occurs.

Configure VM acceleration on macOS

On MacOS, the Android Emulator uses the built-in Hypervisor.Framework, which requires the MacOS v10.10 (Yosemite) and higher.

Configure VM acceleration on Linux

Linux-based systems support VM acceleration through the KVM software package. Follow the instructions for installing KVM on your Linux system, and then verify that KVM is enabled. For Ubuntu systems, see Ubuntu KVM Installation.

Requirements

Running KVM requires specific user permissions. Make sure that you have sufficient permissions as specified in the KVM installation instructions.

To use VM acceleration on Linux, your computer must also meet these requirements:

  • For Intel processors: Support for Virtualization Technology (VT-x), Intel EM64T (Intel 64) features, and Execute Disable (XD) Bit functionality enabled.
  • For AMD processors: Support for AMD Virtualization (AMD-V).

Check whether KVM is currently installed on Linux

You can use the emulator -accel-check command-line option to check whether you have KVM installed. Alternatively, you can install the cpu-checker package containing the kvm-ok command.

The following example shows how to use the kvm-ok command:

  1. Install the cpu-checker package:

    sudo apt-get install cpu-checker
    egrep -c '(vmx|svm)' /proc/cpuinfo
    

    An output of 1 or greater means that virtualization is supported. An output of 0 means that your CPU doesn't support hardware virtualization.

  2. Run the kvm-ok command:

    sudo kvm-ok
    

    Expected output:

    INFO: /dev/kvm exists
    KVM acceleration can be used
    

    If you get the following error, it means that you can still run virtual machines. However, your virtual machine is slower without the KVM extensions.

    INFO: Your CPU does not support KVM extensions
    KVM acceleration can NOT be used
    

Install KVM on Linux

Use the following command to install KVM:

Cosmic (18.10) or later:

sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

Lucid (10.04) or later:

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

Karmic (9.10) or earlier:

sudo aptitude install kvm libvirt-bin ubuntu-vm-builder bridge-utils