20

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

  1. Windows HyperVisor Platform
  2. 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....\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=c0350005
C:\Users....\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument

Anyone got suggestions, how to resolve this issue.

Supriyo Mahanta
  • 233
  • 1
  • 3
  • 11

10 Answers10

19

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

windows: https://dl.google.com/android/repository/emulator-windows_x64-7869535.zip
linux: https://dl.google.com/android/repository/emulator-linux_x64-7869535.zip
macosx: https://dl.google.com/android/repository/emulator-darwin_x64-7869535.zip


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:

  1. Open Turn Windows features on or off.
  2. Uncheck Hyper-V and Windows Hypervisor platform (it may be required to uncheck Windows Sandbox).
  3. Open Android Studio and SDK Manager.
  4. In SDK tools, install Android Emulator Hypervisor Driver for AMD Processors (installer).

Open the emulator with no acceleration

  1. Open a terminal.
  2. Enter cd C:\Users\User\AppData\Local\Android\Sdk\emulator\ with your user.
  3. Enter .\emulator.exe -avd Pixel_4a_API_30 -accel off with your AVD device name.
Zeswen
  • 261
  • 4
  • 12
7

You must disable "Virtual Machine Platform" too, not just Hyper-V enter image description here

georgeci
  • 347
  • 5
  • 16
7

The latest version of Android Emulator - 31.1.2 is fixing the issue. Update through SDK Manager. Released 11/11/2021.

5

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.

surban
  • 128
  • 3
  • 3
2

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. :)

Marco
  • 147
  • 1
  • 5
  • 2
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30243677) – Dalija Prasnikar Nov 03 '21 at 13:26
2

There is a fix for this issue see:

https://issuetracker.google.com/issues/202188690#comment45

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

1

This works for me with an intel I7 11gen processor on latest version of windows 11 pro, Open Turn Windows features on or off Uncheck Hyper-V, Virtual Machine Platform, Windows Hypervisor Platform, Windows Sandbox and close Memory 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

0

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

Tim Phillips
  • 95
  • 1
  • 3
0

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.

Isak
  • 548
  • 2
  • 5
  • 20
0

In the windows 11 Version 22H2 OS Build 22581.200 : Goto Windows Security --> Device Security --> Core Isolation --> Memory Integrity (Turn this to Off)

Vinamra Jaiswal
  • 603
  • 7
  • 15