ADB命令

目录

    1. adb --help:查看帮助手册

    2. adb devices:检测连接到电脑的安卓设备

    3. adb version:查看adb版本

    4. adb start-server:开启adb服务器

    5. adb kill-server:关闭adb服务器

    6. adb shell:登录设备shell

    7. adb logcat:打印日志

    8. adb connect/disconnect 设备IP地址:通过WiFi远程连接手机进行调试

      • 1)将手机连接到PC端
      • 2)adb devices 检测到设备
      • 3)adb tcpip 5555 确定手机端和PC端的通讯端口号
      • 4)拔掉手机和电脑之间连接的数据线,adb connect 手机IP地址
    9. adb pull <手机路径> <本机路径>:从手机中拉取信息到本机

    10. adb push <本机路径> <手机路径>:从本机推送信息到手机

    11. adb install app安装包:在手机中安装软件(-r:保留数据和缓存文件)

    12. adb uninstall 包名:卸载软件(-k:保留数据和缓存文件)

    13. adb reboot recovery:重启到recovery模式

    14. adb reboot bootloader:重启到fastboot模式

      • fastboot reboot:退出fastboot模式
    15. adb root:获取设备的root权限

    16. adb remount:将“/system”部分置于可写入模式(需要先执行:adb root)

    17. adb shell dumpsys 参数:打印出当前系统信息,参数如下:

      • account:查看手机上的账户信息
      • battery:查看电池状态
      • wifi:查看WiFi信息
      • usb:查看usb信息
    18. adb shell am force-stop 包名:强制停止应用

    19. adb shell pm list packages:查看所有应用的包名

      • -d:只输出禁用的包名
      • -e:只输出启用的包名
      • -s:只输出系统应用的包名
      • -i:输出包名和安装信息
      • -f:输出包名和包相关联的文件
      • -3:输出所有第三方包名
    20. 查看某个应用的包名

      • 1)adb shell
      • 2)logcat | grep START(cmp=)
      • 3)在手机端点击进入所需查看的应用
    21. adb shell dumpsys activity | find "mFocusActivity":查看前台应用启动(activity)名(只是适用于Linux系统和Mac系统)

    22. adb shell input tap x y:模拟触屏

      • x,y表示触摸点的横纵坐标
    23. adb shell input swipe x1 y1 x2 y2:模拟滑动

      • (x1,y1)起始坐标点
      • (x2,y2)终止坐标点
    24. adb shell input keyevent n:模拟按键(n表示数字)

      • 3:home建
      • 4:返回键
      • 5:拨号键
      • 6:挂断电话
      • 24:音量增加
      • 25:音量减少
      • 26:电源键
      • 82:菜单键
      • 164:静音键
      • 223:系统休眠
      • 224:点亮屏幕
    posted @ 2019-12-08 22:14  雨牧  阅读(139)  评论(0编辑  收藏  举报