如何在 Windows Server 2019 中为 Android 模拟器启用硬件加速?

How to enable hardware acceleration for Android Emulator in Windows Server 2019?

我有一个 AMD CPU,带有 Windows Server 2019(不要问为什么),我在其中启用了 Hyper-V。但是,在我的(稳定频道)Android Studio 中,它仍然显示

Unfortunately, your computer does not support hardware accelerated virtualization. Here are some of your options:

1) Use a physical device for testing

2) Develop on a Windows/OSX computer with an Intel processor that supports VT-x and NX

3) Develop on a Linux computer that supports VT-x or SVM

4) Use an Android Virtual Device based on an ARM system image (This is 10x slower than hardware accelerated virtualization)

启用 Hyper-V 的模拟器选项是否仅在 Android Studio 的 Beta 通道中可用?如何在 Windows Server 2019 中为 Android 模拟器启用硬件加速?

经过一个小时的搜索,我发现 Hyper-VWindows Hypervisor Platform (WHPX) 不一样。虽然您可以在 Windows Server 2019 中通过 GUI 启用 Hyper-V,但您不能对 WHPX 执行相同的操作。除了在 BIOS 中启用虚拟化和通过 GUI 模式 Hyper-V 之外,要在 Windows Server 2019(以及可能的其他服务器版本)上启用 WHPX,运行 PowerShell 中的以下命令具有提升的权限:

Dism /Online /Enable-Feature:HypervisorPlatform

它在 运行 执行命令后工作,即使没有重新启动。