adb基本命令 & Monkey发生随机事件命令及参数说明_weixin_30491641的博客-优快云博客
随机运行一千次
adb shell monkey -p com.mem.MacaoLife -v 1000
随机运行1千次,90%概率是滑动,等待300毫秒
adb shell monkey -p com.mem.MacaoLife --throttle 300 --pct-touch 90 1000
杀死app
|
停止APP进程,并且清除这个APP进程产生的所有数据,相当于reset
|
安装软件
adb install 拖动文件到cmd
查询当前运行app的包名
adb shell dumpsys window w |findstr \/ |findstr name=
结束和启动adb服务,重启服务
adb kill-server
adb start-server
将手机文件拷贝到电脑
adb pull /sdcard/aa/20211104180257_com.mema.csv D:/aaa.csv
打印及清除系统日志:
adb logcat
adb logcat -c 清除
获取内存
adb shell dumpsys meminfo (包名com.mem.MacaoLife)
获取cpu:
adb shell dumpsys cpuinfo | findstr com.mem.MacaoLife(包名com.mem.MacaoLife)
查看app安装路径
进入shell
adb shell
pm list packages -f | grep (包名)com.mem.MacaoLife
过滤日志将日志存放在手机里
adb shell
logcat -f /sdcard/Pictures/6.txt | grep com.mem.MacaoLife
将手机文件传输到电脑
adb pull system/file.txt D:/
在cmd窗口查看手机的Log日志
adb logcat -v time *:E >D:/android3.txt
//格式1:打印默认日志数据
adb logcat
//格式2:需要打印日志详细时间的简单数据
adb logcat -v time
//格式3:需要打印级别为Error的信息
adb logcat *:E
//格式4:需要打印时间和级别是Error的信息
adb logcat -v time *:E
//格式5:将日志保存到电脑固定的位置,比如D:\log.txt
adb logcat -v time >D:\log.txt
————————————————
adb logcat -v time *:E >D:/android3.txt
1、设备相关
adb devices
2、adb服务器杀死和启动
adb kill-server
adb start-server
3、文件相关
adb push local remote
adb pull remote local其中 local代表的是PC端的某个位置,
remote代表移动设备或者模拟器的某个位置
4、装包、卸载包
adb -s deviceid install apk在PC端的路径
adb shell pm install apk在移动端的路径
adb uninstall 包名
5、与Activity操作等相关
找到当前手机内的top Activity:
adb shell dumpsys activity top | findstrACTIVITY
启动某一个Activity:
adb shell am start activity路径
———————这个Activity路径可通过上面获取top
activity的方式获取
6、与进程相关:
列出当前进程
adb shell ps | findstr 包名
杀死某个包的进程
adb shell am force-stop 包名
7、与性能相关的一些内容
获取内存:
adb shell dumpsys meminfo 包名
获取cpu:
adb shell dumpsys cpuinfo | findstr 包名
adb shell top -n 1 | findstr 包名
获取流畅度相关:
adb shell dumpsys gfxinfo 包名
8、其他非adb但常用的一些工具
获取安装包信息:aapt dump badging apk在PC端的路径
————需要配置环境变量,具体路径在可sdk中查找
获取app的UI层级结构:uiautomatorviewer————需要配置环境变量,具体路径在可sdk中查找