adb截图为什么不直接保存到pc上?

如题,最近搜索adb截图,网上的方法大都是保存到手机存储,然后再从手机存储复制到PC上。

adb shell screencap /sdcard/1.png
adb pull /sdcard/1.png .

通过查看adb screencap命令的帮助看到:

 ~/Downloads  adb shell screencap -h
usage: screencap [-hp] [-d display-id] [FILENAME]
   -h: this message
   -p: save the file as a png.
   -j: save the file as a jpeg.
   -d: specify the display id to capture, default 0.
If FILENAME ends with .png it will be saved as a png.
If FILENAME is not given, the results will be printed to stdout.

如果不指定文件名,是可以将图片内容输出到stdout中的,因此可以这样直接保存到pc:

adb shell screencap -p > 1.png

经尝试也没有问题,可为什么都没有人这么用呢?

阅读 11.8k
4 个回答

经过测试,adb shell screencap -p > 1.png的方式在android 6.0.1版本上无法使用,在7.0及以后系统中正常。

6.0版本可以使用adb exec-out screencap -p > 1.png

测试手机:MOTO XT1077,CM 13.0,Android 6.0.1。

可能网上发教程的人跟我一样,不知道这个用法吧。。。

Android Studio 自带截图功能

图片描述

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题