我尝试在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:失败
这是在Ubuntu 20.04下,使用Android Studio 2020.03.1和模拟器插件版本30.7.5.0。
我尝试过的解决方法:
- 我已经尝试创建一个新的模拟器,但仍然出现相同的问题。 - 这个问题类似,但是答案适用于macOS。 - 另一个答案建议卸载并重新安装模拟器插件,但对我没有用。 - 这个答案提供了另一种配置方法,但会导致分段错误("segmentation fault"),没有与Vulkan相关的错误消息。
当我使用
-gpu guest
运行模拟器时,一切正常。这意味着当我手动更改文件~/.android/avd/Pixel_4_API_30_-_GooglePlay.avd/config.ini
以将hw.gpu.mode
从auto
设置为guest
时,它可以运行。我认为这只是一种解决方法,而不是真正的解决方法,因为硬件渲染将不再工作,而软件渲染下,模拟器的系统界面每隔几秒钟就会崩溃。