5

This is my first time attempting anything Android. I have installed Android Studio 2021.3.1 Patch 1 on Ubuntu 22.04 and created an Empty Compose Activity as a test.

The Device Manager looks like this

enter image description here

But when I try to run it I get

The emulator process for AVD Pixel_XL_API_33 has terminated

idea.log contains

INFO -      Emulator: Pixel XL API 33 - [...]android-sdk/emulator/emulator -netdelay none -netspeed full -avd Pixel_XL_API_33 -qt-hide-window -grpc-use-token -idle-grpc-timeout 300 
INFO -      Emulator: Pixel XL API 33 - Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A) 
INFO -      Emulator: Pixel XL API 33 - emulator: INFO: Found systemPath [...]/android-sdk/system-images/android-33/google_apis/x86_64/ 
WARN -      Emulator: Pixel XL API 33 - Failed to process .ini file ~/.android/avd/Pixel_XL_API_33.avd/quickbootChoice.ini for reading. 
WARN -      Emulator: Pixel XL API 33 - cannot add library [...]/android-sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed 
INFO -      Emulator: Pixel XL API 33 - WARNING: lavapipe is not a conformant vulkan implementation, testing use only. 
INFO -      Emulator: Pixel XL API 33 - Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) 
ERROR -      Emulator: Pixel XL API 33 - Emulator terminated with exit code 139 

This happens with Android 5.0 and 8.1 projects.

As per this question I have tried sudo ubuntu-drivers autoinstall which gives

"/usr/bin/ubuntu-drivers", line 187, in command_install
    UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
  File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in nvidia_desktop_pre_installation_hook
    with_nvidia_kms = version >= 470
UnboundLocalError: local variable 'version' referenced before assignment

and mesa-vulkan-drivers are already installed.

How do I fix this error and run a basic project out-of-the-box in an emulator on Linux?

2 Answers 2

4

I don't really have a solution, but a workaround: I had the same problem on openSUSE Leap 15.4 and could solve it by choosing "Software - GLES 2.0" for "Emulated Performance" when creating an emulated device.

It seems, the problem with libvulkan.so only occurs when using "Hardware - GLES 2.0" or "Automatic" which in my case seems to also choose the Hardware setting.

So as I said, I don't know how to fix the problem with hardware rendering, but for me the software rendering is good enough, though probably slightly slower.

3

If mesa-vulkan-drivers is already installed (sudo apt install mesa-vulkan-drivers)

  • try to update your NVIDIA driver: sudo ubuntu-drivers autoinstall
  • then reboot your system

If the ubuntu-driver command fails with this error:

UnboundLocalError: local variable 'version' referenced before assignment

You can try the fix from here but in my case it selected a driver which did not recognize my display anymore (wrong resolution), so I selected the latest proprietary driver myself:

  • Open "Additional Drivers" in the Ubuntu Launcher
  • Select the latest proprietary driver listed here
  • Apply (this takes a while) and reboot your system

enter image description here

Tested on Ubuntu 22.04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .