我用的是Ubuntu 18.04,我的Android Studio是3.4,在真机上运行app没有问题,用虚拟设备运行就报错:
2:45 Emulator: statvfs('/home/zf/.android/avd/Pixel_3_API_22.avd/snapshots/default_boot/ram.img') failed: No such file or directory
2:45 Gradle build finished in 6 s 850 ms
2:46 ADB rejected shell command (getprop): closed
2:46 Emulator: Process finished with exit code 0
3:17 Emulator: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
看来,关键原因是“没有这样的文件或目录”,这是什么意思,我该如何解决它?
答案1
我修复了错误
(模拟器:statvfs('/home/zf/.android/avd/Pixel_3_API_22.avd/snapshots/default_boot/ram.img')失败:
没有此文件或目录)
将 的群组所有者更改ram.img
为libvirt
:
sudo chgrp libvirt ram.img
并更改权限以允许读写:
chmod 766 ram.img
答案2
这通常与以下错误同时发生:
Emulator: Warning: QStandardPaths: XDG_RUNTIME_DIR points to non- existing path '/run/user/1000/snap.android-studio', please create it with 0700 permissions. ((null):0, (null))
就我的情况来说,这个问题已经通过以下方式修复:
mkdir -m 0700 /run/user/1000/snap.android-studio