無法讓 Hyper-V 與 Android 模擬器 Visual Studio 搭配使用

無法讓 Hyper-V 與 Android 模擬器 Visual Studio 搭配使用

這是我嘗試讓 Hyper-V 與 Android 模擬器結合使用的第二台機器,但仍然沒有找到答案。我缺什麼?

配置:

AMD Ryzen 9 9300x Processor, 32 Gb Ram, 1Tb SSD. 
BIOS Version/Date   American Megatrends Inc. P4.20, 6-11-2020

在 PowerShell 中使用以下命令:

PS C:\Windows\system32> Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V


FeatureName      : Microsoft-Hyper-V
DisplayName      : Hyper-V Platform
Description      : Provides the services that you can use to create and manage virtual machines and their resources.
RestartRequired  : Possible
State            : Enabled
CustomProperties :

PS C:\Windows\system32> get-service | findstr vmcompute
Running  vmcompute          Hyper-V Host Compute Service
PS C:\Windows\system32> wmic OS Get DataExecutionPrevention_Available
DataExecutionPrevention_Available
TRUE

PS C:\Windows\system32> wmic OS Get DataExecutionPrevention_SupportPolicy
DataExecutionPrevention_SupportPolicy
2

甚至使用 wbemtest 將上述值設為 1,如下所述:


EDIT
Value is back to 2 after reboot


https://docs.microsoft.com/en-us/troubleshoot/windows-client/performance/define-hardware-dep-available

模擬器都使用 x86,但仍然說我應該打開 Hyper-V:

在此輸入影像描述

值 = TRUE 表示 Hyper-V 處於活動狀態並已開啟。

在此輸入影像描述

答案1

對於所有有這個問題的人。這是解決方案。

讀完本頁後:https://docs.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/troubleshooting?pivots=windows#accel-issues-win

我執行了以下命令:

PS C:\Windows\system32> Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online                                                                                                                                                   
FeatureName      : Microsoft-Hyper-V-All
DisplayName      : Hyper-V
Description      : Provides services and management tools for creating and running virtual machines and their resources
                   .
RestartRequired  : Possible
State            : Enabled
CustomProperties :

PS C:\Windows\system32> Get-WindowsOptionalFeature -FeatureName HypervisorPlatform -Online


FeatureName      : HypervisorPlatform
DisplayName      : Windows Hypervisor Platform
Description      : Enables virtualization software to run on the Windows hypervisor
RestartRequired  : Possible
State            : Disabled
CustomProperties :

預設情況下,虛擬機器管理程式似乎被禁用(為什麼要大聲喊叫)。下面的命令啟用了它。這應該位於文件中,而不是隱藏在故障排除頁面的某個位置。

PS C:\Windows\system32> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Path          :
Online        : True
RestartNeeded : False

PS C:\Windows\system32> Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform -All


Path          :
Online        : True
RestartNeeded : False

相關內容