有没有人经历过并解决过这样的问题?
我们使用adb shell screencap命令来捕获Android设备上的屏幕截图:
//catch and download screenshot
adb shell "screencap -p /sdcard/screen.png"
adb pull "/sdcard/screen.png" "tempPictPathName"
//clean
adb shell "rm /sdcard/screen.png"
它完美地工作了相当长的一段时间。由于某种原因(我们的代码中没有任何变化,测试设备上也没有),当从cmd和代码运行相同的命令时,我们开始收到“No space left on device”错误:
>adb shell "screencap -p /sdcard/screen.png"
Error opening file: /sdcard/screen.png (No space left on device)
我们已检查,设备上有足够的空间:
$ ls -l /storage/
lrwxrwxrwx root root 2018-12-16 10:35 sdcard -> /storage/emulated/legacy
$su -c df
Filesystem Size Used Free Blksize
/storage/emulated 930.4M 0.0K 930.4M 4.0K
/storage/emulated/0 8.9G 6.1G 2.9G 4.0K
/storage/emulated/0/Android/obb 8.9G 6.1G 2.9G 4.0K
/storage/emulated/legacy 8.9G 6.1G 2.9G 4.0K
/storage/emulated/legacy/Android/obb 8.9G 6.1G 2.9G 4.0K
我们尝试更改.png文件的位置,但没有成功:
>adb shell "screencap -p /sdcard/Download/screen.png"
Error opening file: /sdcard/Download/screen.png (No space left on device)
>adb shell "screencap -p /storage/sdcard/Download/screen.png"
Error opening file: /storage/sdcard/Download/screen.png (No space left on device)
重启设备后,adb shell "screencap -p /sdcard/screen.png"
命令成功,但仅成功一次。当我们尝试通过相机拍照来保存图片时-没有报告问题
什么原因会导致“无空间”错误?
1条答案
按热度按时间yh2wf1be1#
您访问的页面不存在。
您可以尝试一些列出的存储位置,即.
所以你的代码应该是:
如果这不可能,您可以使用以下命令:
其他替代方案可以是使用变量
$EXTERNAL_STORAGE