常用命令列表
adb
pm:包管理
adb shell pm clear 包名
#1. 清理特定包缓存数据、权限
#2. 强制关掉app
am:activity管理
adb shell am start -n 包名
#重新启动,但不清除缓存
dumpsys:获取系统/app的性能数据
uiautomator:获得app的页面结构,进行自动化测试
1 adb shell uiautomator
#有子命令介绍
2 adb shell uiautomator dump
#会在手机上生成当前app所有的控件界面到一个xml文件,可以被拉取下来
3 adb shell "uiautomator dump && cat /路径"
#生成并拉取文件到这个路径
input:完成简单的自动化指令
adb shell input
adb shell input tap 529 1176 添加坐标,模拟点击事件
Android 性能统计 dumpsys
获取所有的dumpsys 子命令
dumpsys | grep -i DUMP
获取当前activity
shell dumpsys activity top
获取 activities 的记录,可以获取到appium 依赖的原始 activity
dumpsys activity activities
获取特定包基本信息
adb shell dumpsys package 包名
获取系统通知
adb shell dumpsys notification
获取内存信息
adb shell dumpsys meminfo 包名
获取cpu信息
adb shell dumpsys cpuinfo
获取gpu 绘制分析
adb shell dumpsys gfxinfo 包名
获取短信
adb shell dumpsys activity broadcasts |grep senderName=
uiautomator
adb shell uiautomator runtest
adb shell uiautomator dump
test <string> (Default: touchscreen)
keyevent[--longpress]<key code number or name> ...(Default: keyboard)
tap <x><y>(Defauult: touchscreen)
swipe <x1><y1><x2><y2>[duration(ms)](Default: touchscreen)
press (Default:trackball)
roll <dx><dy>(Default: trackball)