Enable hardware acceleration for the Android emulator (Hyper

您所在的位置:网站首页 北京幼升小非京籍社保要求 Enable hardware acceleration for the Android emulator (Hyper

Enable hardware acceleration for the Android emulator (Hyper

#Enable hardware acceleration for the Android emulator (Hyper| 来源: 网络整理| 查看: 265

How to enable hardware acceleration with Android emulators (Hyper-V & HAXM) Article 06/24/2022

This article explains how to use your computer's hardware acceleration features to maximize Android emulator performance.

With Visual Studio, you can easily test and debug your .NET MAUI app for Android in situations where an Android device isn't available. However, if hardware acceleration isn't available or enabled, the emulator will run too slow. You can drastically improve the performance of the emulator by enabling hardware acceleration and using x86-64 or x86 virtual device images.

Scenario HAXM WHPX Hypervisor.Framework You have an Intel Processor X X X You have an AMD Processor X You want to support Hyper-V X You want to support nested Virtualization Limited You want to use technologies like Docker (with WSL2) X X Accelerating Android emulators on Windows

The following virtualization technologies are available for accelerating the Android emulator:

Microsoft's Hyper-V and the Windows Hypervisor Platform (WHPX).

Hyper-V is a virtualization feature of Windows that makes it possible to run virtualized computer systems on a physical host computer.

Intel's Hardware Accelerated Execution Manager (HAXM).

HAXM is a virtualization engine for computers running Intel CPUs.

For the best experience on Windows, it's recommended you use WHPX to accelerate the Android emulator. If WHPX isn't available on your computer, then HAXM can be used. The Android emulator automatically uses hardware acceleration if the following criteria are met:

Hardware acceleration is available and enabled on your development computer.

The emulator is running a system image created for an x86-64 or x86-based virtual device.

Important

You can't run a VM-accelerated emulator inside another VM, such as a VM hosted by VirtualBox, VMware, or Docker (unless using WSL2). You must run the Android emulator directly on your system hardware.

For information about launching and debugging with the Android emulator, see Debugging on the Android Emulator.

Accelerating with Hyper-V

Before enabling Hyper-V, read the following section to verify that your computer supports Hyper-V.

Verifying support for Hyper-V

Hyper-V runs on the Windows Hypervisor Platform. To use the Android emulator with Hyper-V, your computer must meet the following criteria to support the Windows Hypervisor Platform:

Your computer hardware must meet the following requirements:

A 64-bit Intel or AMD Ryzen CPU with Second Level Address Translation (SLAT). CPU support for VM Monitor Mode Extension (VT-c on Intel CPUs). Minimum of 4-GB memory.

In your computer's BIOS, the following items must be enabled:

Virtualization Technology (may have a different label depending on motherboard manufacturer). Hardware Enforced Data Execution Prevention.

Your computer must be running Windows 11 or Windows 10 Version 1909 or later.

To verify that your computer hardware and software is compatible with Hyper-V, open a command prompt and type the following command:

systeminfo

If all listed Hyper-V requirements have a value of Yes, then your computer can support Hyper-V. For example:

If the Hyper-V result indicates that a hypervisor is currently running, Hyper-V is already enabled.

Enabling Hyper-V acceleration in Windows and the emulator

If your computer meets the above criteria, use the following steps to accelerate the Android emulator with Hyper-V:

Enter windows features in the Windows search box and select Turn Windows features on or off in the search results. In the Windows Features dialog, enable both Hyper-V and Windows Hypervisor Platform:

After making these changes, reboot your computer.

Important

On Windows 10 October 2018 Update (RS5) and higher, you only need to enable Hyper-V, as it will use Windows Hypervisor Platform (WHPX) automatically.

Make sure that the virtual device you created in the Android Device Manager is an x86-64 or x86-based system image. If you use an Arm-based system image, the virtual device won't be accelerated and will run slowly.

After Hyper-V is enabled, you'll be able to run your accelerated Android emulator.

Accelerating with HAXM

Important

HAXM is only supported on Intel CPUs.

If your computer doesn't support Hyper-V, you may use HAXM to accelerate the Android emulator. To use HAXM, disable Device Guard.

Verifying HAXM support

To determine if your hardware supports HAXM, follow the steps in Does My Processor Support Intel Virtualization Technology?. If your hardware supports HAXM, you can check to see if HAXM is already installed by using the following steps:

Open a command prompt window and enter the following command:

sc query intelhaxm

Examine the output to see if the HAXM process is running. If it is, you should see output listing the intelhaxm state as RUNNING. For example:

If STATE isn't set to RUNNING, then HAXM isn't installed.

If your computer can support HAXM but HAXM isn't installed, use the steps in the next section to install HAXM.

Installing HAXM

HAXM install packages for Windows are available from the Intel Hardware Accelerated Execution Manager GitHub releases page. Use the following steps to download and install HAXM:

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.

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

When you create a virtual device, be sure to select an x86_64 or x86-based system image. If you use an Arm-based system image, the virtual device will not be accelerated and will run slowly.

Troubleshooting

For help with troubleshooting hardware acceleration issues, see the Android emulator Troubleshooting guide.

Related Links Run Apps on the Android Emulator


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3