On my brand new Win11 Pro machine (AMD Ryzen 9 7950X) my Visual Studio 2022 Enterprise installation (v17.7.6) doesn't use hardware acceleration when I disable Hyper-V
and enable AEHD
(or GVM).
When I start an emulated device via the Visual Studio Android Device Manager
this error message shows up and the performance is crazy slow: Hyper-V is not configured. Turn on "Hyper-V" feature to switch to the Native Hypervisor and accelerate your emulator.
When I start it via batch/cmd using "C:\Program Files (x86)\Android\android-sdk\emulator\emulator.exe" -avd pixel_5_-_api_33
everything works fine.
sc query aehd
says: RUNNINGemulator-check.exe hyper-v
says: Hyper-V is not installed (C:\Program Files (x86)\Android\android-sdk\emulator\emulator-check.exe)emulator-check.exe accel
says: GVM (version 2.1) is installed and usable.But most importantly (as mentioned in the short version above): AEHD (hardware acceleration) works when started via cmd.
does Android Device Manager
(which has nothing to do with the Android-Studio/Google Device Manager as the AndroidDevices.exe seems to be by Xamarin Inc.) forces me to have Hyper-V installed?
It took me ages, dozens of uninstall/install of AEHD/Hyper-V and luck to find out its an VS issue and not a driver/installation issue.
I've only found one more post on about the same issue here.
I cannot imagine this being a "global" bug and I'm the only one complaining about this...
Any help, thoughts and hints are highly appreciated. Thanks in advance.
PS: I do not want and cannot install/use Hyper-V as an active Hyper-V is incompatible with other software I'm running.
Here I've found the location of the log files of the Device Manager.
My logfile in c:\Users\<user>\AppData\Local\Xamarin\Logs\17.0\*.devicemanager.log
looks like this:
...
[23-11-05 12:40:43.00] Component Android Emulator hypervisor driver (installer) r2.0.0 [Extra: (Google LLC.)] not present on the system
[23-11-05 12:40:43.00] Component Intel x86 Emulator Accelerator (HAXM installer) r7.6.5 [Extra: (Intel Corporation)] not present on the system
[23-11-05 12:40:43.00] Component Intel x86 Emulator Accelerator (HAXM installer) r7.6.5 [Extra: (Intel Corporation)] not present on the system
...
[23-11-05 12:41:10.00] AVDStatusToButtonTextConverter [Convert]Start
[23-11-05 12:41:10.00] [HypervisorManager] Checking for accelerated emulator: True
[23-11-05 12:41:10.00] [ProcessStartInfoAsInvoker] Executing command: "cmd" "/C" "sc" "query" "intelhaxm"
[23-11-05 12:41:10.02] [ProcessResult] cmd result: StandardOutput: [SC] EnumQueryServicesStatus:OpenService FAILED 1060: The specified service does not exist as an installed service. ExitCode: 1060
[23-11-05 12:41:10.18] [HypervisorManager] IsWHPOn: False
[23-11-05 12:41:10.18] [HypervisorManager] IsHyperVOn: False
[23-11-05 12:41:10.18] [HypervisorManager] SupportsHyperVOnlyAcceleration: True
...
It claims Hypervisor driver is not installed (which in the logged version it isn't). So I installed the official v2.0 from the SDK-Manager and tried again:
...
[23-11-05 12:50:44.84] Detecting component Android Emulator hypervisor driver (installer) r2.0.0 [Extra: (Google LLC.)] in directory 'C:\Program Files (x86)\Android\android-sdk\extras/google/Android_Emulator_Hypervisor_Driver'
[23-11-05 12:50:44.84] Found revision 2.0.0 on the system
[23-11-05 12:40:43.00] Component Intel x86 Emulator Accelerator (HAXM installer) r7.6.5 [Extra: (Intel Corporation)] not present on the system
[23-11-05 12:40:43.00] Component Intel x86 Emulator Accelerator (HAXM installer) r7.6.5 [Extra: (Intel Corporation)] not present on the system
...
[23-11-05 12:41:10.00] AVDStatusToButtonTextConverter [Convert]Start
[23-11-05 12:41:10.00] [HypervisorManager] Checking for accelerated emulator: True
[23-11-05 12:41:10.00] [ProcessStartInfoAsInvoker] Executing command: "cmd" "/C" "sc" "query" "intelhaxm"
[23-11-05 12:41:10.02] [ProcessResult] cmd result: StandardOutput: [SC] EnumQueryServicesStatus:OpenService FAILED 1060: The specified service does not exist as an installed service. ExitCode: 1060
[23-11-05 12:41:10.18] [HypervisorManager] IsWHPOn: False
[23-11-05 12:41:10.18] [HypervisorManager] IsHyperVOn: False
[23-11-05 12:41:10.18] [HypervisorManager] SupportsHyperVOnlyAcceleration: True
...
The driver is no found, but still the same issue. I reckon its a bug in AndroidDevices.exe as it always starts virtual device with Executing command: "cmd" "/C" "sc" "query" "intelhaxm"
which forces HAXM apparently :(
I was able to solve this issue. It is a Visual Studio bug (a bug in AndroidDevices.exe
).
The Executing command: "cmd" "/C" "sc" "query" "intelhaxm"
for above is not starting the virutal device. It is AndroidDevices.exe
checking if the hardware acceleration service is running.
Which is fine for the intelhaxm service. But the new service of android is named gvm or even aehd.
As the check above fails, the log shows the start of the emulator like this:
"C:\Program Files (x86)\Android\android-sdk\emulator\emulator.exe" "-netfast" "-no-accel" "-verbose" "-avd" "pixel_5_-_api_33" "-prop" "monodroid.avdname=pixel_5_-_api_33" "-prop" "emu.uuid=5dbe4647-fd53-466f-ace6-87eb26e48949"
The no-accel
parameter is the culprit here.
My solution is to install the AEHD service/driver from github not named aehd
as it does out of the box. I renamed it to intelhaxm
.
To do this download and extract the latest version (I've done it with v2.1).
Now when running silent_install.bat
it installs a service named intelhaxm
instead of aehd
(fyi: the service does not show in the services list on windows!).
Finally, when AndroidDevices.exe
runs the sc query intelhaxm
command it does get a positive result and starts the emulator without the no-accel
parameter.
I hope Microsoft will fix this issue soon and will look for gvm
and aehd
services as well before deciding to use no-accel
.