ADB 全称是Android Debug Bridge,就是起调试桥的作用。它是一个命令行窗口,用于电脑端与模拟器或者设备之间的交互。
查看当前设备
adb devices
adb devices
多个设备操作,需要带上具体设备号
adb -s 设备号 其他命令
例如:adb -s 1234567 install ...
安装本地 APK
adb install ****.apk
adb install -r *****.apk 覆盖安装
卸载设备中的 APK
adb uninstall 包名
adb uninstall -k 包名 卸载APK保留数据和缓存
上传文件(本地 --> 设备)
adb push 本地文件 设备路径
adb push
下载文件(设备 --> 本地)
adb pull 设备路径 本地路径
adb pull
打印日志
adb logcat 查看所有日志
adb logcat -c 清除所有日志
adb logcat | grep -iER "XXX"过滤指定信息
adb logcat
查看所有APP
adb shell pm list packages
adb shell pm list packages -f //显示出路径
截屏
adb shell screencap /sdcard/index.png
录屏
adb shell screenrecord /sdcard/index.mp4
模拟输入
adb shell input text "***"
模拟触屏
adb shell input tap 400 1000 //在屏幕上(400,1000)的坐标点上进行一次点击
adb shell input keyevent + XX // 发送按键事件 例如:adb shell input keyevent 4 返回
查看当前内存占用
adb shell cat /proc/meminfo
查看CPU和内存占用
adb shell top
查看耗电情况
adb shell dumpsys batterystats
adb shell dumpsys batterystats > xxx.txt 保存信息到具体文件
重启设备
adb reboot
查看设备的后台 进程
adb shell ps
adb shell ps -A | grep "xxx" 查询某个特定进程
启动服务
adb shell am startservice 服务包名路径
强制关闭应用
adb shell am force-stop 应用包名
发送广播
adb shell am broadcast action(动作)
启动Activity
adb shell am start Activity包名路径
屏幕分辨率
adb shell dumpsys window displays |head -n 3
关闭或者杀掉进程
adb shell kill xxx(进程号)
查看正在运行的Activity
adb shell dumpsys activity | grep -i run
页面更新:2024-04-13
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2008-2024 All Rights Reserved. Powered By bs178.com 闽ICP备11008920号-3
闽公网安备35020302034844号