bixiaopeng@bixiaopeng ~$ adb shell screencap -v
screencap: invalid option -- v
usage: screencap [-hp] [-d display-id] [FILENAME]
-h: this message
-p: save the file as a png.
-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.
如果文件名以.png结尾时,它将保存为png文件
如果文件名没有给出,则结果被会被输出到stdout
截图保存到SD卡里再导出
$ adb shell screencap -p /sdcard/screen.png
$ adb pull /sdcard/screen.png
$ adb shell rm /sdcard/screen.png
这种方法比较麻烦,需要3步:1. 截图保存到sdcard 2.将图片导出 3.删除sdcard中的图片
截图直接保存到电脑
$ adb shell screencap -p | sed 's/\r$//' > screen.png
执行adb shell 将\n转换\r\n, 因此需要用sed删除多余的\r
如果直接当命令用还可以用 alias 包裝装起來:
$ alias and-screencap="adb shell screencap -p | sed 's/\r$//'"
$ and-screencap > screen.png
以后就可以方便的用and-screencap > 直接将截图保存到电脑上了
微信搜索“毕小烦”或者扫描下面的二维码,即可订阅我的文章。
如果文章对你有帮助,请随手点个赞吧!
查看帮助命令bixiaopeng@bixiaopeng ~$ adb shell screencap -vscreencap: invalid option -- vusage: screencap [-hp] [-d display-id] [FILENAME] -h: this message -p: save the file as a png. -d: speci
做开发的总会碰到测试或者项目经理问你要某个界面截图的情况,用手机的快捷键截图再上传效率不高,又不太想用手机助手(怕全家桶),便打起Android的ADB命令的主意。adb指令中screencap指令就是截图方法,再通过pull拉取到指定文件夹即可。
这边我对不同的操作系统都进行了相应的整理和使用。windows下为批处理程序,mac下为shell可执行脚本程序。
需注意,脚本使用,都需要先在桌面上新建AndroidScreen文件夹,然后电脑同时只可以连接一台手机(当然这些也都可以完善)。
Window
@echo off
set HOUR=%time:~0,2%
set MINU
PS C:\Users\user> adb shell
root@rk322x_box:/ # screenrecord --help //查看screenrecord命令帮助
Usage: screenrecord [options] <filename>
Android screenrecord v1.2. Records the device's display to a .mp4 file.
android4.0之后内置了截图工具screencap,一般位于/system/bin/screencap
源码路径:frameworks/base/cmds/screencap/
usage: screencap [-h
在安卓开发中, 我们很多时候都要用到截屏这个功能。
有时是为了演示, 有时是为了报告问题(比如在Bugzilla, Jira, Redmine等Bug跟踪系统中上传截图), 有时是为了发布应用时要用的截图。
今天就来聊聊如何快速只用一句简单的命令就搞定截图。
由繁到简的演进:三种方法
这篇主要讲Linux系统下如何Android手机截
通过adb命令截图 adb shell screencap -p /sdcard/01.png
拉取到电脑adb pull /sdcard/01.png e://adb/imgs
也可以保存到文件夹下然后统一拉取
adb shell screencap -p /sdcard/screenshots/01.png
adb pull /sdcard/screenshots e://adb
usage: screencap [-hp] [-d display-id] [FILENAME]
-h: this message
-p: save the file as a png.
-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 r