Android 缺少模拟器错误 WinHvPlatform.dll

Android Emulator Error missing WinHvPlatform.dll

今天,突然间,我所有的 Android 仿真器(在 Win10 / IntelliJ IDEA 上), 开始抱怨缺少图书馆。

当我启动任何模拟器时,在加载过程中,我在控制台日志上看到:

模拟器:无法加载库'WinHvPlatform.dll'

然后,模拟器启动并且似乎 运行 OK。

但是...有人知道这可能是什么原因吗? 那个图书馆是什么?

应该为 Android 模拟器禁用 Hyper-V,并改用 Intel HAXM(如果您的处理器支持它)。还要确保您使用的是更新的 Android SDK 27 工具和模拟器,它们可以更新 as explained in this article.

这是因为 Microsoft 已与 Google 合作,允许使用 Hyper-V 而不是 Intel HAXM 作为管理程序。请参阅这些文章:

The Windows Hypervisor Platform was introduced in the Windows 10 April 2018 Update and enables third-party virtualization stacks to utilize the Windows Hypervisor for hardware acceleration. If you are using Hyper-V, this stack replaces Intel HAXM as the hypervisor for the Android emulator.

如果你 运行 ANDROID_SDK\emulator\emulator.exe -avd YOURAVD -verbose 你可能会得到这个输出:

emulator: Checking whether Windows Hypervisor Platform (WHPX) is available.
emulator: Could not load library WinHvPlatform.dll
emulator: WHPX is either not available or not installed.
emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: HAXM is not installed on this machine
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!

您可以按照上述帖子中的说明为 Google 中 %USERPROFILE%\.android\advancedFeatures.ini 中的 Android 模拟器关闭 Windows Hypervisor,方法是设置:

WindowsHypervisorPlatform=off