1. Are you ready for the Galaxy S20? Here is everything we know so far!

Running Android emulator on WSL-2

Discussion in 'Android Development' started by Mark WoodPatrick, Nov 10, 2021.

  1. Mark WoodPatrick

    Thread Starter

    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
     



    1. Download the Forums for Android™ app!


      Download

       
  2. Unforgiven

    Unforgiven ...eschew obfuscation...
    Moderator

    Development thread moved to the dev area for better exposure. Good luck!! :)
     
  3. Mark WoodPatrick

    Thread Starter

    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
     
  4. Mark WoodPatrick

    Thread Starter

    Fixing the maximum number of open files "via ulimit -n" fixed my crash but emulator still hangs so I installed the windows version and it also hangs. Has anyone else gotten the android emulator to run on windows 11 with hyper-V enabled? Any suggestions on how to debug?
     
  5. Mark WoodPatrick

    Thread Starter

    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
     
Loading...
Similar Threads - Running Android emulator
  1. sean5678
    Replies:
    2
    Views:
    229
  2. Burbankjim
    Replies:
    1
    Views:
    740
  3. ALL Macs
    Replies:
    2
    Views:
    662
  4. Drygord
    Replies:
    2
    Views:
    725
  5. JHolt
    Replies:
    0
    Views:
    1,251
  6. ALL Macs
    Replies:
    2
    Views:
    1,150
  7. ninodor
    Replies:
    1
    Views:
    692
  8. ninodor
    Replies:
    1
    Views:
    437
  9. Adddeeee
    Replies:
    0
    Views:
    2,323
  10. seeknp
    Replies:
    4
    Views:
    1,032

Share This Page

Loading...