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:
- I have already tried creating a new emulator, but the same issue occurs.
- This question is similar but the solution is for macOS
- Another answer suggesting uninstallation and reinstallation of the Emulator plugin also didn’t work for me
- This answer suggests another config, which also leads to a segmentation fault (
handleCpuAcceleration: feature check for hvf [1] 1694643 segmentation fault (core dumped)
, but no Vulkan-related error messages
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.
3
Answers
The issue was solved by updating the system packages via:
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.My solution was similar to @slhck but instead I changed Nvidia GPU drivers to use the recommended version.
https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-20-04-focal-fossa-linux
If
sudo ubuntu-drivers autoinstall
fails, you can also select the latest proprietary driver yourselve:Apply
(this takes a while) and reboot your system