ADB常用命令
ADB(Android Debug Bridge) adb安卓调试桥
在电脑的命令行输入adb命令:
启动adb
adb start-server
关闭abd
adb kill-server
查看已经连接的设备
adb devices
操作指定设备
adb -s 设备id 命令
给某个设备上传文件
adb -s devices-ID push /confused_uncle/Desktop/test.txt /sdcard
从某个设备下载文件
adb -s devices-ID pull /sdcard/test.txt /confused_uncle/Desktop
给某个设备上安装app
adb -s devices-ID install /confused_uncle/Desktop/douyin.apk
卸载某个设备上的app
adb -s devices-ID uninstall douyin.apk (安装包的名称)
adb -s devices-ID uninstall com.taobao.idlefish
查看设备里的包列表
adb -s devices-ID shell pm list packages 查看包列表
adb -s devices-ID shell pm list packages -e 关键字 查看包列表(搜索)
查看设备处理器(32位/64位)
adb shell getprop ro.product.cpu.abi
>>> armeabi-v7a(32位ARM设备)
>>> arm64-v8a(64位ARM设备)
查看Android版本
adb shell getprop ro.build.version.release (release: 新发行的东西)
从电脑进入手机系统,并获取超级用户权限
电脑shell
admin@adminMBP ~ % adb shell 切换到手机里
手机shell
device:/ $ su
device:/ # pwd
在电脑端重启手机设备
adb reboot
查看手机系统运行进程
adb shell ps
获取手机屏幕分辨率
adb shell wm size
手机屏幕密度
adb shell wm density
手机屏幕点击
adb shell input tap X1 Y1 屏幕上点击的x,y坐标(coordinate)
手机屏幕滑动(速度太快,不常用)
adb shell input swipe X1 Y1 X2 Y2 起始点(x1,y1) ---滑动到---> 终点(x2,y2)
adb shell input swipe 720 1280 720 0
手机屏幕带时间滑动
adb shell input swipe X1 Y1 X2 Y2 time(ms) 起始点(x1,y1) ---滑动到---> 终点(x2,y2) 持续时间time(单位ms)
1.先获取手机分辨率
adb shell wm size
>>> 1440x2580
2.从手机中心滑动到手机上边缘,用时1000ms
adb shell input swipe 720 1280 720 0 1000
其他command:
- 查看电池信息:adb shell dumpsys battery
- 查看设备ID:adb shell settings get secure android_id
- 查看设备IMEI:adb shell dumpsys iphonesubinfo
- 查看手机网络信息:adb shell ifconfig
- 查看设备日志:adb logcat
- 查看系统磁盘情况:adb shell ls /path/
- 手机设备截屏:adb shell screencap -p /sdcard/aa.png
- 手机设备录像:adb shell screenrecord /sdcard/ab.mp4
- 手机文本输入:adb shell input text xxxxx
- 手机键盘事件:adb shell input keyevent xx
......