在对移动端操作之前需要开启USB调试:点击设置---关于手机----版本号(连续点击7次后返回设置)---开发人员选项----右上角打开开发模----下方找到USB调试模式---进行勾选
1. adb devices 检测adb是否连接到设备
2. adb push 电脑的路径 设备的路径(如:adb pull C:\ada /sdcard ) 把文件从电脑拷贝到设备上
3. adb pull 设备的路径 电脑的路径 (如:adb pull /sdcard C:\ada ) 把设备的的文件导入到电脑上
4. adb shell 进入到设备
4.1 ls 显示出当前路径下的所有文件
4.2 cd /data 进入到data 的路径下 以此类推
4.3 exit 退出
5. adb insatll apk路径 adb安装应用
6. adb shell dumpsys window | findstr mCurrentFocus 获取当前应用的包名
7. adb uninstall 包名 adb卸载应用
8. adb reboot 重启设备
9.adb -s SN reboot 指定设备重启 -s 用与指定设备
10.adb logcat >D:\123.txt 用于抓取adb log保存到D盘中123.txt中(如果D盘没有123.txt则会新建)
11.adb kill-server 杀死adb的server进程
12.adb start-server 启动adb 的server进程
13.adb shell input相关的操作有text、keyevent、tap、swipe、(press、roll轨迹球这两个操作已经无用)分别对应输入文本、功能键、点击、滑动(长按)
14.如何把手里安装的软件变成apk导出来
1.查看当前包名
adb shell dumpsys window | findstr mCurrentFocus
2.通过命令找到apk所在的文件
adb shell pm path 包名
3. 通过adb pull 传输到的电脑上
adb pull 全部的路径 电脑的路径
15. adb shell settings put system pointer_location 1 开划线命令 (也可在开发者里面打开)
16. adb shell input tap x y 模拟位置点击(x,y)
17. adb shell input swipe x y x1 y1 模拟滑动( xy是开始的坐标,x1y1是要滑动到目标的坐标 )
18.ADB模拟按键
adb shell input keyevent 26 电源键
adb shell input keyevent 82 菜单键
adb shell input keyevent 3 HOME 键
adb shell input keyevent 4 返回键
adb shell input keyevent 164 静音
adb shell input keyevent 224 亮屏
adb shell input keyevent 223 灭屏