lxq.link
postscategoriestoolsabout

adb 常用命令

android adb 文档地址: https://developer.android.google.cn/studio/command-line/adb


# 查看adb版本:
adb version

# 查看所有设备:
adb devices

# 安装指定apk,如果连接多个设备,使用 -s 参数指定具体目标
adb install hello.apk
adb -s emulator-5556 install hello.apk

# 通过 WLAN 连接到设备 :
adb connect device_ip_address:port(默认端口号是:5555)

# 断开设备:
adb disconnect device_ip_address:port

# 执行远程的shell:
adb shell
# e.g.
# 模拟键盘点击两次 R 键
adb shell input text "RR"
# 卸载指定包
adb shell pm uninstall com.example.MyApp

# 退出远程命令:
exit

# 执行远程shell命令:
adb shell shell_command

# 拷贝文件到设备上:
adb push local_path remote_path

# 从设备中拷贝文件:
adb pull remote_path local_path

# 查看命令帮助:
adb help

2020-05-19