• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Running Android emulator on WSL-2

I'm running android studio & emulator on WSL-2 it reports that the emulator is out of date even though the version number is 30.9.5.0 (build_id 7820599), anyone know why? Also emulator eventaully crashes, any suggestions on best way to debug or who I can work with on this?

mwoodpatrick@MarkSpectre14:/mnt/c/Users/mlwp$ /home/mwoodpatrick/Android/Sdk/emulator/emulator -avd Pixel_C_API_30
INFO | Android emulator version 30.9.5.0 (build_id 7820599) (CL:N/A)
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
WARNING | cannot add library /home/mwoodpatrick/Android/Sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
INFO | added library /home/mwoodpatrick/Android/Sdk/emulator/lib64/vulkan/libvulkan.so
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
INFO | configAndStartRenderer: setting vsync to 60 hz
INFO | Started GRPC server at 127.0.0.1:8554, security: Local
INFO | Advertising in: /mnt/wslg/runtime-dir/avd/running/pid_29639.ini
INFO | Your emulator is out of date, please update by launching Android Studio:
- Start Android Studio
- Select menu "Tools > Android > SDK Manager"
- Click "SDK Tools" tab
- Check "Android Emulator" checkbox
- Click "OK"
INFO | boot completed
INFO | boot time 130958 ms
INFO | Increasing screen off timeout, logcat buffer size to 2M.
INFO | Revoking microphone permissions for Google App.
Segmentation fault
 
I downloaded the android SDK and build and ran the tests and they all passed. When I ran the emulator under gdb it turns out the failure was "libc++abi: terminating with uncaught exception of type std::__1::system_error: random_device failed to open /dev/urandom: Too many open files". Reviewing the code it seems that the apple build checks if it can open 16k files but the Linux version does not, seems like this is an issue on WSL-2 but there is a workaround windows subsystem for linux - How can I raise the limit for open files in Ubuntu 20.04 on WSL2? - Stack Overflow I will give this a try and see how it goes. Why do we need so many open files? Is there any architectural documentation on the emulator all I could find so far has been the help that is useful? I Will update as I discover more
 
Upvote 0
Running without hw acceleration:

C:\Users\mlwp\AppData\Local\Android\Sdk\emulator> .\emulator.exe -avd Pixel_C_API_30 -no-accel -show-kernel

got further.

Running on the command line with hw accel I see "failed to initialize WHPX: Invalid argument"

PS C:\Users\mlwp\AppData\Local\Android\Sdk\emulator> .\emulator.exe -avd Pixel_C_API_30 -show-kernel
INFO | Android emulator version 30.9.5.0 (build_id 7820599) (CL:N/A)
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
INFO | added library vulkan-1.dll
INFO | configAndStartRenderer: setting vsync to 60 hz
ERROR | Failed to open /qemu.conf, err: 2
C:\Users\mlwp\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=c0350005
C:\Users\mlwp\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones