鍍金池/ 問(wèn)答/Android  數(shù)據(jù)庫(kù)/ adb截圖為什么不直接保存到pc上?

adb截圖為什么不直接保存到pc上?

如題,最近搜索adb截圖,網(wǎng)上的方法大都是保存到手機(jī)存儲(chǔ),然后再?gòu)氖謾C(jī)存儲(chǔ)復(fù)制到PC上。

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

通過(guò)查看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.

如果不指定文件名,是可以將圖片內(nèi)容輸出到stdout中的,因此可以這樣直接保存到pc:

adb shell screencap -p > 1.png

經(jīng)嘗試也沒(méi)有問(wèn)題,可為什么都沒(méi)有人這么用呢?

回答
編輯回答
忘了我

圖片描述

2017年11月16日 04:05
編輯回答
不二心

Android Studio 自帶截圖功能

圖片描述

2017年4月17日 18:31
編輯回答
敢試

可能網(wǎng)上發(fā)教程的人跟我一樣,不知道這個(gè)用法吧。。。

2017年8月5日 22:14
編輯回答
影魅

經(jīng)過(guò)測(cè)試,adb shell screencap -p > 1.png的方式在android 6.0.1版本上無(wú)法使用,在7.0及以后系統(tǒng)中正常。

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

測(cè)試手機(jī):MOTO XT1077,CM 13.0,Android 6.0.1。

2018年5月21日 08:02