Android记录--adb常规其他使用

71 阅读1分钟

除了打印日志外的其他常规使用方式

adb连接设备进行安装:

adb连接到设备后,可以使用install命令安装指定apk文件

adb install -r xxx/xxx/aaa.apk

adb启动应用,指定包名和启动页面

adb shell am start com.xx.xxxx/.ui.activity.MainActivity

重启,查看设备,进入首屏

adb reboot

adb devices

adb shell input keyevent KEYCODE_HOME

adb 查看页面栈

Activity:

通用:      adb shell "dumpsys activity activities | grep -A 20 "TaskRecord.*com.example.app" "
11+:       adb shell "dumpsys activity activities | grep '* ActivityRecord{.*com.example.app' "

Fragment:

adb shell "dumpsys activity top | grep '#[0-9]: ' | grep -A 2 'com.example.app'"

实时监控:

adb logcat -v time | findstr "ActivityTask"