androidandroid-studioandroid-emulatorandroid-studio-arctic-fox

Android Emulator does not start after Arctic Fox upgrade, libvulkan.so: failed


Trying to start an emulator in Android Studio gives me the following error:

The emulator process for AVD Pixel_4_API_30_-_GooglePlay has terminated.

I get the following errors logged in Android Studio logs:

2021-08-11 13:38:19,827 [ 290921]   INFO - manager.EmulatorProcessHandler - Emulator: /home/werner/Android/Sdk/emulator/emulator -netdelay none -netspeed full -no-snapshot-load -avd Pixel_4_API_30_-_GooglePlay 
2021-08-11 13:38:19,885 [ 290979]   INFO - manager.EmulatorProcessHandler - Emulator: handleCpuAcceleration: feature check for hvf 
2021-08-11 13:38:19,927 [ 291021]   INFO - manager.EmulatorProcessHandler - Emulator: cannot add library /home/werner/Android/Sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed 
2021-08-11 13:38:19,933 [ 291027]   INFO - manager.EmulatorProcessHandler - Emulator: added library /home/werner/Android/Sdk/emulator/lib64/vulkan/libvulkan.so 
2021-08-11 13:38:20,091 [ 291185]   INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) 
2021-08-11 13:38:20,091 [ 291185]   WARN - manager.EmulatorProcessHandler - Emulator terminated with exit code 139 

The error boils down to:

cannot add library /home/werner/Android/Sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed

This is under Ubuntu 20.04 with Android Studio 2020.03.1 and the emulator plugin version 30.7.5.0.

What I've seen/tried:

When I run the emulator with -gpu guest, everything works fine.

This means that when I manually change the file ~/.android/avd/Pixel_4_API_30_-_GooglePlay.avd/config.ini to set hw.gpu.mode from auto to guest, it runs fine. I consider this a workaround and not a real solution, as HW rendering will not not work anymore, and with SW rendering, the System UI of the emulator keeps crashing every couple of seconds.


Solution

  • The issue was solved by updating the system packages via:

    sudo apt update && sudo apt dist-upgrade
    

    In my case, it was installing the latest version of mesa-vulkan-drivers that probably fixed the issue. I hadn't upgraded my system in a while.