Configure Emulator graphics rendering and hardware acceleration

The Android Emulator can use several hardware acceleration
features to improve performance, sometimes drastically. Android Studio typically prompts you to
install any required software and suggests the best configuration for your development computer.
This page describes how you can fine-tune the graphics and virtual machine (VM) acceleration
settings, if needed, and manually install VM acceleration software.

Configuring graphics acceleration

Graphics acceleration for the emulator takes advantage of the graphics hardware on your
development computer, specifically the graphics processing unit (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 that graphics
acceleration occur in hardware or software to emulate the GPU of the virtual device. Hardware
acceleration is typically faster. Software acceleration is useful if your computer uses graphics
drivers that aren't compatible with the emulator, in which case hardware graphics rendering can be
poor or cause the emulator to crash.

The default is to let the emulator decide if it should use hardware or software graphics
acceleration based on your computer setup. If the GPU hardware and drivers are compatible, the
emulator uses the GPU; otherwise, the emulator uses the 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, if needed.

host: Use the GPU on your computer. This option is typically the fastest.
However, some drivers have issues with rendering OpenGL graphics, so using the computer GPU
might not be a reliable option.

swiftshader_indirect: Use a Quick Boot-compatible variant of
SwiftShader
to render graphics in software. It's slower than using the GPU, but normally yields good results.
Added in revision 27.0.2.

angle_indirect: (Windows only) Use a Quick Boot-compatible variant of
ANGLE Direct3D
that renders graphics in software. This is a good alternative to host mode when
your computer isn't compatible with the hardware acceleration in the emulator. In most cases,
ANGLE performance should be similar to using -gpu host, which uses OpenGL instead
of Microsoft DirectX. On Windows, Microsoft DirectX drivers normally have fewer issues than
OpenGL drivers. This option uses Direct3D 11 and requires Windows 10, Windows 8.1, or
Windows 7 SP1 + Windows 7 Platform Update. Added in revision 27.0.2.

guest: Use guest-side software rendering. This option is slow.

If you enable a graphics acceleration option that your computer doesn't support, you are likely to
see incorrect images displayed.

swiftshader: Deprecated in revision 27.0.2—instead use
swiftshader_indirect. Use
SwiftShader
to render graphics in software. It's slower than using the GPU, but normally yields good results.
Added in revision 25.3.

mesa: Deprecated in revision 25.3—instead use
swiftshader_indirect. Use the Mesa 3D software library to render graphics.

Enabling Skia rendering for Android UI

When using images for API 27 or later, the emulator can render the Android UI with
Skia, which can render more smoothly and
efficiently.

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

su
setprop debug.hwui.renderer skiagl
stop
start

Configuring VM acceleration

Many modern CPUs provide extensions for running VMs more efficiently. Taking advantage of these
extensions with the emulator can require some additional configuration of your development computer,
but can significantly improve the execution speed. This section outlines the VM acceleration
requirements and setup steps for each operating system.

Dependencies and prerequisites

To use VM acceleration with the emulator, you need to meet the following Android development
tools requirements:

SDK Tools: minimum version 17; recommended version 26.1.1 or later

AVD with an x86-based system image, available for Android 2.3.3 (API level 10) and higher

AVDs that use ARM- or MIPS-based system images can't be accelerated using the emulator
configurations described on this page.

Virtualization extension requirements

Before attempting to use acceleration, you should first determine if your CPU supports one of the
following virtualization extensions technologies:

Intel Virtualization Technology (VT, VT-x, vmx) extensions

AMD Virtualization (AMD-V, SVM) extensions

Most modern computers do. If you use an older computer and you're not sure, consult the
specifications from the manufacturer of your CPU to determine if it supports virtualization
extensions. If your CPU doesn't support one of these virtualization technologies, then you can't use
VM acceleration.

Virtualization extensions are typically enabled through your computer BIOS and are frequently
turned off by default. Check the documentation for your motherboard to find out how to enable
virtualization extensions.

About hypervisors

Emulator acceleration requires a hypervisor. The recommended hypervisor on Mac computers
and on Windows computers with Intel CPUs is Intel Hardware Accelerated Execution Manager (Intel HAXM).
The hypervisor used on Linux is Kernel-based Virtual Machine (KVM). It is possible to use Windows
Hypervisor Platform (WHPX) on Windows if you have an AMD CPU or if you need to use Hyper-V at the
same time as the Android Emulator.

Without acceleration, the emulator takes the machine code from the VM and translates it block by
block to conform to the architecture of the host computer. This process can be quite slow. But, if
the VM and the architecture of the host computer match (such as x86 on x86), the emulator can skip
translating the code and simply run it directly on the actual CPU using a hypervisor. In this case,
the emulator can approach the speed of the host computer.

If the needed hypervisor isn't installed, Android Studio typically prompts you to install it.
Typically, Android Studio prompts you to install the needed software when you do any of the
following:

Install Android Studio and SDK Tools.

Create and manage AVDs in the AVD Manager.

Select an AVD to run from the Select Deployment Target dialog.

Determining whether HAXM or KVM is installed

If you ever need to check whether HAXM or KVM is installed, you can use the emulator
-accel-check command-line option.

For example, here's sample output on a Mac, where sdk is the Android
SDK location:

VM acceleration 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 the emulator directly on your system hardware.

You can't run software that uses another virtualization technology at the same time that
you run the accelerated emulator. For example, VirtualBox, VMWare, and Docker currently use a
different virtualization technology, so you can't run them at the same time as the accelerated
emulator.

Configuring VM acceleration on Windows

The recommended configuration for VM acceleration of the emulator on on Windows uses HAXM on an
Intel CPU. However, if you have an AMD CPU or if you need to run the emulator at the same time as
Hyper-V (for example, while using Docker), then you can use these other configurations.

Warning: Some hardware setups are incompatible with WHPX or
Hyper-V, and enabling of these features can cause Windows to fail to boot completely and instead
show a black screen. In this case, you must disable virtualization in the BIOS and start Windows
to disable WHPX or Hyper-V. For this reason, we recommend that you use the emulator with HAXM and an
Intel CPU when possible.

Configuring VM acceleration with HAXM on Windows with an Intel CPU

VM acceleration for Windows on an Intel CPU requires the installation of Intel HAXM.

64-bit Windows 7, Windows 8, or Windows 10 (or 32-bit version of the operating system
on a 64-bit CPU)

To use HAXM on Windows 8 or 10, turn off Hyper-V in the Control Panel. Installing certain
software might turn Hyper-V back on. In this case, where possible, Android Studio displays a "quick
fix" link in certain dialogs that lets you easily turn Hyper-V off again.

You can adjust the amount of memory available to the Intel HAXM kernel extension by running
the installer again.

You can stop using the virtualization driver by uninstalling it. To remove the software, run the
installer or use the Control Panel.

Configuring VM acceleration with Windows Hypervisor Platform

Though we recommend using HAXM on Windows, it is possible to use Windows Hypervisor Platform
(WHPX) with the emulator. You should use WHPX with the emulator if you are using an AMD CPU or if
you need to use Hyper-V at the same time.

Requirements and recommendations for using Windows Hypervisor Platform:

To use WHPX acceleration on Windows, you must enable the Windows Hypervisor Platform
option in the Turn Windows features on or off dialog box. For changes to this option to take
effect, restart your computer.

Additionally, the following changes must be made in the BIOS settings:

Intel CPU: VT-x must be enabled.

AMD CPU: Virtualization or SVM must be enabled.

Configuring VM acceleration on Mac

On Mac OS X v10.10 Yosemite and higher, the Android Emulator uses the built-in
Hypervisor.Framework
by default, and falls back to using HAXM if Hypervisor.Framework fails to initialize.

To use VM acceleration on a Mac on which Hypervisor.Framework is not available, you must install
the Intel HAXM kernel extension to allow the emulator to make use of CPU virtualization extensions.

Note for users of macOS 10.13 High Sierra and higher: macOS 10.13 disables installation of
kernel extensions by default. Because HAXM is a kernel extension, you might need to manually enable
its installation. For more details, see Known Issues.

After the download finishes, run the installer.
For example, it might be in this location:sdk/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM_version.dmg.
To begin installation, in the Finder, double-click the IntelHAXM.dmg file
and then the IntelHAXM.mpkg file.

Follow the on-screen instructions to complete the installation.

After installation finishes, confirm that the new kernel extension is operating correctly by
opening a terminal window and running the following command:

kextstat | grep intel

You should see a status message containing the following extension name, indicating that the
kernel extension is loaded:

You can adjust the amount of memory available to the Intel HAXM kernel extension by running
the installer again.

You can stop using the virtualization kernel driver by uninstalling it. Before removing it, shut
down any running x86 emulators. To unload the virtualization kernel driver, run the following
command in a terminal window: