Android Hyper V 错误的模拟器

Android emulator on Hyper V error

Microsoft 最近宣布支持 hyper V (https://blogs.msdn.microsoft.com/visualstudio/2018/05/08/hyper-v-android-emulator-support/)运行android 模拟器

我正在尝试使用以下命令行在我的 Windows 10(2018 年 4 月更新)启用 Hyper V 的机器上启动 Android 模拟器 27.2.9.0:

> cd C:\Users\<username>\AppData\Local\Android\sdk\emulator\lib\qt\lib
> ..\..\..\emulator -avd <avd name> -feature WindowsHypervisorPlatform

我收到以下错误消息:

emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable.
CPU acceleration status: Please disable Hyper-V before using the Android Emulator.  Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.

我已将“WindowsHypervisorPlatform = on”行添加到 C:\Users\.android\advancedFeatures.ini,但这没有帮助。

我错过了什么?

为了在我的电脑上运行,我做了一些事情。

  • 安装 Visual Studio 15.8 预览版 1 或更高版本
  • 在 Visual Studio 预览版
  • 中删除并重新安装模拟器
  • 我从 android sdk 管理器中的 "Extras" 中删除了 HAXM(来自 visual studio 菜单)。
  • advancedFeatures.ini 的路径是 C:\Users\Your Username\advancedFeatures.ini 设置 WindowsHypervisorPlatform = on
  • 打开打开或关闭 Windows 功能以及 select Hyper-V 和 Windows 管理程序平台复选框。 (需要重新启动)

这里还有微软的另一个指南:https://docs.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin

嗯,原来我启用了"Hyper-V",但是"Windows Hypervisor Platform"没有启用。 (谁知道这是两个不同的东西!)。启用后,模拟器开始工作。

使用最新的 Android Studio,您不需要 Hyper-V AMD。

只需启用 "Windows Hypervisor Platform"(打开和关闭屏幕上的 windows 功能),x86 图像应该会自动可用

我只需要卸载 "Hyper-V Hypervisor",模拟器就开始工作了。我正在使用 Windows 10 (1803)。如果我安装 "Hyper-V Hypervisor".

,模拟器将停止工作

运行 cmd 中的以下命令以管理员身份打开以禁用 hyper-v 然后重新启动计算机:

bcdedit /set hypervisorlaunchtype off

这个命令对我有用。