Configure hardware acceleration for the Android 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.

Đọc thêm

Requirements

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

Đọc thêm

Configure graphics acceleration in the AVD Manager

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

Đọc thêm

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:The value of mode can be set to one of the following options:The following mode options are deprecated:

Đọc thêm

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:

Đọc thêm

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.

Đọc thêm

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.

Đọc thêm

Development environment requirements

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

Đọc thêm

Virtualization extension requirements

In addition to the development environment requirements, your computer's processor must support virtualization extensions. Supported processors are: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.

Đọc thêm

Restrictions

VM acceleration has the following restrictions:

Đọc thêm

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:

Đọc thêm

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: macOS: Linux:

Đọc thêm

Configure VM acceleration on Windows

VM acceleration on Windows can use one of two hypervisors:

Đọc thêm

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.

Đọc thêm

Configure VM acceleration using Windows Hypervisor Platform

Before you can enable WHPX, your computer must meet the following requirements:To install WHPX on Windows, follow these steps:

Đọc thêm

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: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: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 higherAEHD 2.0 and lower

Đọc thêm

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. However, Android Studio may require higher version for the macOS. In such cases, follow the Android Studio system requirements.

Đọc thêm

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.

Đọc thêm

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:

Đọc thêm

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:

Đọc thêm

Install KVM on Linux

Use the following command to install KVM:Cosmic (18.10) or later: Lucid (10.04) or later: Karmic (9.10) or earlier:

Đọc thêm

Guide for Intel HAXM Uninstallation

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.It is recommended to remove Intel HAXM completely from your Windows system, unless you have other software installed that depends on HAXM and you choose to keep Intel HAXM and manage it on your own.To uninstall Intel HAXM, follow these steps:

Đọc thêm

Check whether Intel HAXM is installed

To determine whether Intel HAXM is installed on your Windows system, open a Windows command console and run the following command:If Intel HAXM is installed and running, you should see the following message in the command output. If Intel HAXM is installed but disabled, you should see the following message in the command output. In both cases, regardless whether Intel HAXM is running or disabled, it is installed. You need to go to the next step to continue to uninstall Intel HAXM.If Intel HAXM is not installed, you should see the following message.

Đọc thêm

Uninstall Intel HAXM using SDK manager from the Android Studio

Open the SDK manager from the Android Studio, get to the "SDK Tools" tab, then navigate to the "Intel x86 Emulator Accelerator (HAXM installer) - Deprecated" line. It should look like the following screenshot. Clear the checkbox as shown in the following screenshot. Click "Apply" button and the following dialog should pop up. When Intel HAXM is successfully uninstalled, you should see the following. Uninstallation is done and you can stop here. In case of any errors, continue to the next step.

Đọc thêm

Uninstall Intel HAXM using Windows "settings".

Open Windows "settings" and navigate to "Apps > Installed apps".Locate the "Intel Hardware Accelerated Execution Manager" entry and click "Uninstall", as shown in the following screenshot. The Intel HAXM uninstaller should run and report the result. If the uninstallation is successful, go to Delete Intel HAXM installer package. Otherwise, continue to the next step.

Đọc thêm

Uninstall using command line

Đọc thêm

Delete Intel HAXM installer package.

This step is only required when uninstalling Intel HAXM using Windows "settings" or command line. Without this step, the SDK manager of the Android Studio may continue listing Intel HAXM as "Installed".The installer package is located at<Your Android SDK folder>extrasintel. By default, Android SDK will be installed at "C:Users<Your Windows User ID >AppDataLocalAndroidSdk". See example in the following screenshot.

Đọc thêm

Bạn đã thích câu chuyện này ?

Hãy chia sẻ bằng cách nhấn vào nút bên trên

Truy cập trang web của chúng tôi và xem tất cả các bài viết khác!

Vosc