![模拟器:statvfs('/home/zf/...snapshots/default_boot/ram.img')失败:没有此文件或目录](https://linux22.com/image/914284/%E6%A8%A1%E6%8B%9F%E5%99%A8%EF%BC%9Astatvfs%EF%BC%88'%2Fhome%2Fzf%2F...snapshots%2Fdefault_boot%2Fram.img'%EF%BC%89%E5%A4%B1%E8%B4%A5%EF%BC%9A%E6%B2%A1%E6%9C%89%E6%AD%A4%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95.png)
我用的是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