#我的新年Flag#ADB 常用指令

时间:2023-02-01 17:58:09
It's not about ideas, it's about making ideas happen
查看当前连接设备
C:\Users\BZZX>adb devices
List of devices attached
192.168.30.16:5555 device
连接指定设备
adb -s
C:\Users\BZZX>adb -s 192.168.30.16:5555 shell wm size
Physical size: 1920x1080
重启adb server
restart adbd
查询安装的所有应用
adb -s 192.168.30.16:5555 shell pm list packages
查询安装第三方应用
adb -s 192.168.30.16:5555 shell pm list packages -3
查询安装系统应用
adb -s 192.168.30.16:5555 shell pm list packages -s
查询安装某个应用
adb -s 192.168.30.16:5555 shell pm list packages 'game'
安装应用指令
adb install -r  允许覆盖安装
adb install -d 允许降级安装
adb install -s 允许安装应用到
清除某个应用缓存数据
adb -s 192.168.30.16:5555 shell pm clear com.zc.gamehall
查看应用安装路径
adb -s 192.168.30.16:5555 shell pm path com.zc.gamehall
启动应用、调起activity
adb shell am start -n com.zc.gamehall/com.zc.gamehall.MainActivity
启动应用的某个服务
adb shell am startservice -n com.android.systemui/.SystemUIService
向所有应用发送一条广播
adb shell am broadcast -a android.intent.action.SCREEN_ON  屏幕点亮广播
强制停止某个应用
adb -s 192.168.30.16:5555 shell am force-stop  com.zc.gamehall
模拟输入Home键
adb -s 192.168.30.16:5555 shell input keyevent 3
模拟输入返回键
adb -s 192.168.30.16:5555 shell input keyevent 4
抓去日志
adb -s 192.168.30.16:5555 shell logcat -v time  : <datetime> <priority>/<tag>(<pid>): <message>
adb -s 192.168.30.16:5555 shell logcat -v threadtime : 08-28 22:39:39.974 1785 1832 D HeadsetStateMachine: Disconnected process message: 10, size: 0