adb命令

参考 ADB SHELL

adb调试

  • adb devices
    获取连接到adb的所有设备,返回设备序列号。
  • adb kill-server
    杀死adb服务进程
  • adb start-server
    打开adb服务进程

包管理

安装apk
  • adb install test.apk
  • adb install -l test.apk
    forward lock application
  • adb install -r test.apk
    安装并替换已存在的apk
  • adb install -t test.apk
    允许测试包
  • adb install -s test.apk
    安装到SD卡
卸载apk
  • adb uninstall com.test.app
  • adb uninstall -k com.test.app
    卸载apk但保存应用数据
查看包名
  • adb shell pm list packages
  • adb shell pm list packages -f
    获取带路径的包名
  • adb shell pm list packages -d
    只显示停止运行的包名
  • adb shell pm list packages -e
    只显示正在运行的包名
  • adb shell pm list packages -s
    只显示系统包名
  • adb shell pm list packages -3
    只显示第三方包名
打印包名路径
  • adb shell pm path
    打印包名所对应的apk路径
清除包
  • adb shell pm clear com.test.abc
    清除关联的包,包括缓存和数据

文件管理

  • adb pull [local]
    从设备上拉取文件到本地
  • adb push
    把文件从本地推送到设备上
  • adb shell ls [options]
    列出当前目录下的文件和目录,需要root权限
  • adb shell cd
    进入目录
  • adb shell rm [options]
    删除目录下的文件
    options = -r :force remove without prompt
    options = -f :remove the contents of directories recursively
    options = -d :remove directory, even if it is a non-empty directory
  • adb shell mkdir [options]
    创建一个目录
    options = -p :如果没有父目录,会同时创建父目录
  • adb shell pwd
    打印当前路径
  • adb shell cp [options]
    复制目录或文件
  • adb shell mv [options]
    移动或重命名文件

网络

Monkey

  • 基本语法
    adb shell monkey [options]
    如果没有设置任何参数,Monkey会随机的在安装的应用上跑。
  • 典型应用
    `adb shell monkey -p your.package.name -v 500
    表示Monkey在特定的package发送500次伪随机事件,包括点击,触摸或手势操作。
    详细请参考monkey命令

你可能感兴趣的:(adb命令)