microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.35k stars 815 forks source link

Android emulator not starting anymore #6471

Closed ad-on-is closed 3 years ago

ad-on-is commented 3 years ago

Windows 10 21296 AMD 4800H

I don't know whether this is related to WSL, Windows or Android emulator itself, but here's what's happening.

I used to run WSL2, Docker (WSL2) and Android Studio emulator side-by-side. Everything worked. Docker was up and running in WSL2. I could launch emulators from within Android Studio.

Now, the emulators stopped working. AVD Manager throws a The emulator process for AVD Pixel_4_API_30 was killed. error, without further information.

When I try to run it manually via the console, I get these errors:

.\emulator -avd Pixel_4_API_30

WHPX: Failed to get virtual processor registers, hr=c0350005
WHPX: Failed to emulate PortIO access with EmulatorReturnStatus: 64
WHPX: Failed to exec a virtual processor
RikkaW commented 2 years ago

@LefanTan The change is from https://issuetracker.google.com/issues/202188690#comment18, I only do the compiling work.

Commenting out this line whpx_disable_xsave(whpx); (https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/target/i386/whpx-all.c#1768).

jmSfernandes commented 2 years ago

I found a solution from the Google issue tracker to make AVD work with Hyper-V enabled on my AMD CPU. https://issuetracker.google.com/issues/202188690#comment18

image

This requires compiling qemu, but I didn't encounter problems while following the guide.

Binary files compiled by me: https://paste.c-net.org/BlatantEnjoying. Extract to <ANDROID_SDK>/emulator/qemu/windows-x86_64.

Nice Job. It worked for me as well. Windows 11 22000.282 and Amd Ryzen 9 5900HS

carellano commented 2 years ago

Encontré una solución del rastreador de problemas de Google para hacer que AVD funcione con Hyper-V habilitado en mi CPU AMD. https://issuetracker.google.com/issues/202188690#comment18

imagen

Esto requiere compilar qemu, pero no encontré problemas al seguir la guía .

Archivos binarios compilados por mí: https://paste.c-net.org/BlatantEnjoying . Extraer a <ANDROID_SDK>/emulator/qemu/windows-x86_64.

it worked for me on my zephyrus laptop, AMD Ryzen 9 5900HS

Edition Windows 11 Pro Insider Preview Version Dev Installed on 10/27/2021 OS build 22489.1000 Experience Windows Feature Experience Pack 1000.22489.1000.0

hanskokx commented 2 years ago

I found a solution from the Google issue tracker to make AVD work with Hyper-V enabled on my AMD CPU. issuetracker.google.com/issues/202188690#comment18

image

This requires compiling qemu, but I didn't encounter problems while following the guide.

Binary files compiled by me: paste.c-net.org/BlatantEnjoying. Extract to <ANDROID_SDK>/emulator/qemu/windows-x86_64.

Confirmed working. Thank you!

moodstubos commented 2 years ago

@RikkaW Thank you sooooooo much!

hanskokx commented 2 years ago

Bah, this was working until I rebooted my  computer. [0074d13f-3dde-4b01-9c47-883048e75621]

lepskiy commented 2 years ago

I found a solution from the Google issue tracker to make AVD work with Hyper-V enabled on my AMD CPU. https://issuetracker.google.com/issues/202188690#comment18

image

This requires compiling qemu, but I didn't encounter problems while following the guide.

Binary files compiled by me: https://paste.c-net.org/BlatantEnjoying. Extract to <ANDROID_SDK>/emulator/qemu/windows-x86_64.

I replaced qemu files from the archive to /emulator/qemu/windows-x86_64 as you said but have another error now:

Faulting application name: qemu-system-x86_64.exe, version: 0.0.0.0, time stamp: 0x6173cab6
Faulting module name: libOpenglRender.dll, version: 0.0.0.0, time stamp: 0x61057360
Exception code: 0xc0000005

Before the replacement the error was:

Faulting application name: qemu-system-x86_64.exe, version: 0.0.0.0, time stamp: 0x61057379
Faulting module name: MSVCP140.dll, version: 14.29.30135.0, time stamp: 0x612d915a
Exception code: 0xc0000005

My CPU and Android Emulator configiguration is: AMD Ryzen 9 5900HS with Radeon Graphics. Android emulator version 30.8.4.0 (build_id 7600983) (CL:N/A) android-info.txt: Emulator: version-sysimage-git_pi-dev-sdk_gphone_x86_64-userdebug=4833817

NPadrutt commented 2 years ago

For me that gives me now this error, which persists even when I set the gpu.mode to off. image

grinder15 commented 2 years ago

I'm looking for a fix for this too, I'm using Windows 11 Pro - 21H2 22000.194 and AVD doesn't work with Virtual Machine Platform enabled, but if I disable AVD works and WSL 2 don't.

I'm think that's valid to reopen the issue

I've experience this today after installing WSL on Windows 11, Just refer to this comment and will save you from headache. I spent 5 hours screaming in agony without knowing Android emulator will not work if you have WSL installed on a Ryzen setup.

I really agree, we need to reopen this issue.

mikehardy commented 2 years ago

This seems to indicate AMD + win11 + Hyper-V (that is, WSL2) can work now https://issuetracker.google.com/issues/202188690

scrubbybetter commented 2 years ago

Can confirm, Windows 21327 fixes the issue.

Can confirm

What is windows 21327? I have same issue but I haven't resolved yet. Let me know more details.

alexanderbkl commented 3 months ago

solved with.\emulator.exe -avd Medium_Phone_API_35 -feature -Vulkan