5

尝试在 Android Studio 中启动模拟器会给我以下错误:

AVD Pixel_4_API_30__-_GooglePlay 的模拟器进程已终止。

我在 Android Studio 日志中记录了以下错误:

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 

错误归结为:

无法添加库/home/werner/Android/Sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so:失败

这是在带有 Android Studio 2020.03.1 和模拟器插件版本 30.7.5.0 的 Ubuntu 20.04 下。

我所看到/尝试过的:

当我用 运行模拟器时-gpu guest,一切正常。

这意味着当我手动将文件更改为从to~/.android/avd/Pixel_4_API_30_-_GooglePlay.avd/config.ini设置时,它运行良好。我认为这是一种解决方法,而不是真正的解决方案,因为硬件渲染将不再起作用,并且使用软件渲染,模拟器的系统 UI 每隔几秒钟就会崩溃一次。hw.gpu.modeautoguest

4

2 回答 2

4

通过更新系统包解决了这个问题。

就我而言,它安装在最新版本中mesa-vulkan-drivers,可能解决了这个问题。

于 2021-08-16T14:41:31.807 回答
1

我的解决方案类似于@slhck,但我更改了 Nvidia GPU 驱动程序以使用推荐的版本。

sudo ubuntu-drivers autoinstall
sudo reboot

https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-20-04-focal-fossa-linux

于 2021-09-28T18:07:34.740 回答