The Android Emulator can use hardware accelerationfeatures to improve performance, sometimes drastically. This page describes howyou can configure graphics and virtual machine (VM) acceleration to get higherperformance from the emulator.
The Android Developer Challenge is back! Submit your idea before December 2.
Feb 04, 2014 This tutorial shows how to significantly improve the performance of your virtual Android device by using hardware virtualization on an Intel CPU provided by the Intel Hardware Execution Manager (HAXM). First create a basic Android project. Follow this tutorial to do this within Visual Studio. Download and install Intel HAXM.
Configure graphics acceleration
Graphics acceleration uses your computer's hardware (typically the GPU) to makescreen rendering faster. Android devices use OpenGL for Embedded Systems(OpenGL ES or GLES) for rendering both 2D and3D graphics on the screen.
When you create an Android Virtual Device (AVD) in the AVD Manager, you canspecify whether the emulator should use hardware or software to emulatethe GPU of the AVD. Hardware acceleration is recommended and is typicallyfaster. However, you might need to use software acceleration if your computeruses graphics drivers that aren't compatible with the emulator.
By default, the emulator decides whether to use hardware or softwaregraphics acceleration based on your computer setup. If your GPU hardware anddrivers are compatible, the emulator uses the GPU. Otherwise, the emulatoruses software acceleration (using your computer's CPU) to simulate GPUprocessing.
If you start the emulator from thecommand line, you can also overridethe graphics acceleration setting in the AVD for that virtual device instance.
Requirements
To use graphics acceleration, your development environment must meet thefollowing requirements:
Configure graphics acceleration in the AVD Manager
To configure graphics acceleration for an AVD, follow these steps:
Configure graphics acceleration from the command line
To specify a graphics acceleration type when you run an AVD from the commandline, 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:
Enable Skia rendering for Android UI
When using images for API level 27 or higher, the emulator can render theAndroid UI with Skia. Skia helps theemulator render graphics more smoothly and efficiently.
To enable Skia rendering, use the following commands in adb shell:
Configuring VM acceleration
VM acceleration uses your computer's processor to significantly improve theexecution speed of the emulator. A tool called a hypervisor manages thisinteraction using virtualization extensions that your computer's processorprovides. This section outlines the requirements for using VM acceleration anddescribes how to set up VM acceleration on each operating system.
General requirements
To use VM acceleration with the emulator, your computer must meet the generalrequirements in this section. Your computer also needs to meet otherrequirements that are specific to your operating system.
Development environment requirements
To use VM acceleration, your development environment must meet thefollowing requirements:
![]() Virtualization extension requirements
In addition to the development environment requirements, your computer'sprocessor must support one of the following virtualization extensionstechnologies:
Most modern processors support these virtualization extensions. If you're notsure whether your processor supports these extensions, check the specificationsfor your processor on the manufacturer's site. If your processor doesn't supportone of these extensions, then you can't use VM acceleration.
Note: Virtualization extensions are typically enabled through your computer BIOSand are frequently turned off by default. Check the documentation for yourmotherboard to find out how to enable virtualization extensions.
Restrictions
VM acceleration has the following restrictions:
About hypervisors
VM acceleration requires a hypervisor.
Without a hypervisor and VM acceleration, the emulator must translate themachine code from the VM block by block to conform to the architecture of thehost computer. This process can be quite slow. With a hypervisor, the VM andthe architecture of the host computer match, so the emulator can run codedirectly on the host processor using the hypervisor. This improvementdrastically increases both the speed and performance of the emulator.
The hypervisor that will work best for you depends on your computer's operatingsystem and configuration. For more information, see one of the followingsections:
Check if a hypervisor is installed
You can use the emulator
-accel-check command-line option to check ifa hypervisor is currently installed on your computer.
The following examples show how to use use the emulator
accel-check option. Ineach example, sdk is the location of the Android SDK:
Windows:
macOS:
Linux:
Configure VM acceleration on Windows
VM acceleration on Windows can use one of two hypervisors: the Intel HardwareAccelerated Execution Manager (HAXM) or the Windows Hypervisor Platform (WHPX).
Choose a hypervisor on Windows
Use the following criteria to determine which hypervisor you should use:
Configure VM acceleration using Intel HAXM on Windows
Before you can install and use Intel HAXM, your computer must meet the followingrequirements:
To install the Intel HAXM driver, follow these steps:
For more information, seeInstallation Instructions for Intel HAXM on Windows.
You can adjust the amount of memory available to the Intel HAXM kernelextension by running the installer again.
You can uninstall Intel HAXM using either the installer or the Windows ControlPanel. Before you uninstall Intel HAXM, shut down any x86 emulators that arecurrently running.
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:
Configure VM acceleration on macOS
On Mac OS X v10.10 Yosemite and higher, the Android Emulator uses the built-inHypervisor.Framework by default, and falls back to using Intel HAXM if Hypervisor.Framework failsto initialize.
To use VM acceleration on macOS when the Hypervisor.Framework is not available,you must install the Intel HAXM kernel extension.
Note: For users of macOS 10.13 High Sierra and higher: macOS 10.13 disablesinstallation of kernel extensions by default. Because Intel HAXM is a kernelextension, you might need to manually enable its installation. For more details,see Known Issues.
To install the Intel HAXM kernel extension, follow these steps:
For more information, seeInstallation Instructions for Intel HAXM.
You can adjust the amount of memory available to the Intel HAXM kernelextension by running the installer again.
You can stop using the Intel HAXM kernel extension by uninstalling it. Beforeyou uninstall it, shut down any x86 emulators that are currently running, thenrun the following command in a terminal window:
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 verifythat KVM is enabled. For Ubuntu systems, see Ubuntu KVM Installation.
Requirements
Running KVM requires specific user permissions. Make sure that you havesufficient permissions as specified in the KVM installation instructions.
To use VM acceleration on Linux, your computer must also meet theserequirements:
Intel Haxm For Android Studio
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:
Intel Haxm InstallInstall KVM on Linux
Use the following command to install KVM:
Freeware
Windows/macOS/Linux
2.0 MB
15,688
In combination with Android x86 emulator images provided by Intel and the official Android SDK Manager, HAXM allows for faster Android emulation on Intel VT enabled systems.
Windows:
Windows 8 (32/64-bit), Windows 7 (32/64-bit), Windows Vista* (32/64-bit), Windows XP (32-bit only)
Download Intel Haxm Android Studio Windows 7
Mac OS X:
Intel-based Macs with Mac OS X 10.6 and later (32/64-bit)
![]()
Known issue:
Hardware Accelerated Execution Manager Haxm
The Android Emulator may freeze when HAXM and VirtualBox v4.2.14 and newer are run in parallel on the same machine. Our testing shows that previous versions of VirtualBox, v4.2.12 and earlier, don’t exhibit the issue.
Install Haxm Android Studio
Linux
Ubuntu (64-bit)
Popular apps in For DevelopersComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |