1.查看设备

2.开启服务

3.关闭服务

4.安装软件

5.覆盖安装
-r 代表如果apk已安装,重新安装apk并保留数据和缓存文件

6.系统应用:adb shell pm list packages –s
补充:-s #安装在SD卡内,而不是设备内部存储

7.第三方应用:adb shell pm list packages -3

8.列出手机装的所有app的包名
adb shell pm list packages

9.卸载软件



10.如果加 -k 参数,为卸载软件但是保留配置和缓存文件
adb uninstall -k



11.将电脑文件传输到移动端 adb push 电脑路径 移动端路径
将移动端文件传输到电脑 adb pull 移动端路径 电脑路径

12.查看adb命令帮助信息 adb help

13.截屏例:adb shell screencap -p 截图文件路径

14.查看手机CPU情况 adb shell dumpsys cpuinfo

15.查看应用内存使用情况
adb shell dumpsys meminfo +包名:应用的内存使用情况

16.显示磁盘使用信息: adb shell dumpsys diskstats

17.清除应用缓存信息: adb shell pm clear [packagename]



18.查看电池状态 adb shell dumpsys battery

19.查看电池信息adb shell dumpsys batteryproperties
显示当前电池关键属性值(ac:直充,USB,无线、状态、健康指数、当前状态指数、电量等级、音量、暂时声音大小、当前声音大小):

20.-- "-v"选项 : 使用adb logcat -v time 命令, 可以啥看日志的输出时间;
将手机日志输出到本地文件中
adb logcat -v time > C:/log/aa.txt




21.按某级别过滤日志则会将该级别及以上的日志输出。
比如,命令:adb logcat *:W 将 Warning、Error、Fatal 和 Silent 日志输出
显示所有优先级大于等于“warning”的日志

22.adb shell monkey 100 执行monkey测试100次 针对rom测试



23.adb shell monkey -p com.example.login 100



24. 显示日志详细程度
Level 0 : adb shell monkey -p com.example.login -v 100 // 缺省值,仅提供启动提示、测试完成和最终结果等少量信息
Level 1 : adb shell monkey -p com.example.login -v -v 100 // 提供较为详细的日志,包括每个发送到Activity的事件信息
Level 2 : adb shell monkey -p com.example.login -v -v -v 100 // 最详细的日志,包括了测试中选中/未选中的Activity信息



25.将log信息写到文档中adb shell monkey 100 >c:/log/b.txt


26.用亍指定伪随机数生成器的seed值,如果seed相同,则两次Monkey测试所产生的事件序列也相同的。
示例:monkey测试1:adb shell monkey -p com.shjt.map –s 10 100monkey
测试2:adb shell monkey -p com.shjt.map –s 10 100

27.--throttle <毫秒>
用亍指定用户操作(即事件)间的时延,单位是毫秒;如果不指定这个参数,
monkey会尽可能快的 生成和发送消息。

28. --pct-touch <percent>
调整触摸事件的百分比。(触摸事件是指在屏幕中的一个down-up事件,
即在屏幕某处按下并抬起的操作)

29. --pct-motion <percent>
调整motion事件百分比。(motion事件是由屏幕上某处一个down事件、
一系列伪随机的移动事件和一个up事件组成)

30.. --ignore-crashes
作用:通常,应用发生崩溃或异常时Monkey会停止运行。如果设置此项,Monkey将继续发送事件给系统,
直到事件计数完成。正常操作,不忽略异常

31.. --ignore-timeouts(ANR)
作用:通常,应用程序发生任何超时错误(如“Application Not responding”对话框)Monkey将停止运行,
设置此项,Monkey将继续发送事件给系统,直到事件计数完成。

32.adb shell monkey -p com.example.login --ignore-crashes --ignore-timeouts --throttle 100 --pct-touch 50 --pct-motion 50 -v -v 1000 >E:log666.txt

