安装ADB
常用命令
# 查看设备的连接状态 (device | offline | no device)
adb get-state
# 停止adb服务
adb kill-server
# 启动adb服务
adb start-server
# 查看链接设备
adb devices
# 安装apk软件包
adb install ${Package Path}
# 列出所有已安装的软件包包名
adb shell pm list packages
# Powershell > 过滤符合指定关键字的包
adb shell pm list packages | Select-String "chrome"
# shell > 过滤符合指定关键字的包
adb shell pm list packages \| grep chrome
# 卸载软件包
adb shell pm uninstall --user 0 ${Package Path}
# 停用软件
adb shell pm disable-user ${Package Path}
# 启用软件
adb shell pm enable ${Package Path}
# 清除应用数据
adb shell pm clear ${Package Path}
# 从设备复制文件到计算机
adb pull <remote_file_path> <local_file_path>
# 从计算机复制文件到设备
adb push <local_file_path> <remote_file_path>
# 进入设备的 Shell 环境
adb shell
# 查看设备状态
adb shell getprop
# 屏幕录制
adb shell screenrecord <file_path>
# 截图
adb shell screencap -p <file_path>
# 查看网络状态
adb shell netstat
# 转发端口
adb forward tcp:<host_port> tcp:<device_port>
# 重启设备
adb reboot
# 重启到恢复模式
adb reboot recovery