I have Windows 11 on my system.
The system specifiction:
- Edition: Windows 11 Home Single Language
- Update: 21H2
- Installed on: 06-07-2021
- OS build: 22000.65
- Experience: Windows Feature Experience Pack 421.17400.45.3
I have fresh installed Android Studio. Now I want to run the emulator without Intel HAXM as I want to run it alongside wsl2.
So in my optional feature, these two features are enabled
- Windows HyperVisor Platform
- Virtual Machine Platform
But while running the emulator I’m getting this error:
❯ .emulator.exe -avd Pixel_3a_API_30
emulator: Android emulator version 30.7.5.0 (build_id 7491168) (CL:N/A)
handleCpuAcceleration: feature check for hvf
added library vulkan-1.dll
C:Users....AppDataLocalAndroidSdkemulatorqemuwindows-x86_64qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=c0350005
C:Users....AppDataLocalAndroidSdkemulatorqemuwindows-x86_64qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument
Anyone got suggestions, how to resolve this issue.
10
Answers
Final Update:
As stated by Георги Ангелов:
The latest version of Android Emulator – 31.1.2 is fixing the issue. Update through SDK Manager. Released 11/11/2021.
Update:
As stated in Mark Wood-Patrick answer, the emulator hasn’t been updated yet but you can download the new emulator binaries with the fix!
From https://issuetracker.google.com/issues/202188690#comment48
WHPX as of now is not working with Windows 11, I will update this answer when it gets fixed.
There are two possible workarounds:
Disable Hyper-V (Keep in mind WSL2 or any VM won’t work without this)
To disable Hyper-V you must follow these steps:
Turn Windows features on or off
.Hyper-V
andWindows Hypervisor platform
(it may be required to uncheckWindows Sandbox
).Android Emulator Hypervisor Driver for AMD Processors (installer)
.Open the emulator with no acceleration
cd C:UsersUserAppDataLocalAndroidSdkemulator
with your user..emulator.exe -avd Pixel_4a_API_30 -accel off
with your AVD device name.weird for me.
two windows machines.
both with fresh clean iso install of latest windows 11 builds
(tried both dev and beta channels on both machines).
the i9-9900KF desktop will run android emulator using whpx acceleration, the XPS13 i7-1185G7 fails
re-installed windows 10 on the XPS13 and as expected the acceleration works….
i give up
You must disable "Virtual Machine Platform" too, not just Hyper-V
It’s possible to run the emulator from the WSL2 side and it’s what I ended up doing. You can install the GUI version of Android Studio in WSL2 and from there create the emulator as usual.
How to run GUI apps in WSL2 if it’s not working already: https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
Not an answer to the original problem but a workaround for the time being.
This works for me with an intel I7 11gen processor on latest version of windows 11 pro, Open
Turn Windows features on or off
UncheckHyper-V
,Virtual Machine Platform
,Windows Hypervisor Platform
,Windows Sandbox
and closeMemory integrity
(switch from on to off) from the Windows security Core isolation feature, after that you have to restart your device and install new AVD in your android studio and it will work fine.Proof
I have been looking for a solution for a long time, because my Surface Pro 8 came with Windows 11 and I didn’t wanted to switch back to Windows 10. But at the moment there seems to be no really good solution, which made me switch back to Windows 10 for now. Here everything works again. 🙂
Current solution until Google releases a new version of the emulator:
Download the binaries from https://issuetracker.google.com/issues/202188690#comment27 and extract them into your emulator directory, replacing the qemu binaries.
The latest version of Android Emulator – 31.1.2 is fixing the issue.
Update through SDK Manager. Released 11/11/2021.
There is a fix for this issue see:
Can I get more details on how you ran the emulator on wsl2 when I ran it the window came up but nothing was displayed. I am able to run nautilus and android studio on wsl2 without issue. I need to be able to run with hyper-v enabled
In the windows 11 Version 22H2 OS Build 22581.200 :
Goto Windows Security –> Device Security –> Core Isolation –> Memory Integrity (Turn this to Off)