<Android> 常用ADB调试命令

xiaoxiao2021-02-27  364

# 重启和关闭后台服务器 # > adb start-server > adb kill-server # 查看设备 # > adb devices > adb wait-for-device #等待设备接入# # 获取串号 # > adb get-serialno device #有一个设备# unknown #没有设备或有多个设备# # 切换root # > adb root restarting adbd as root #切换成功# adbd cannot run as root in production builds #量产版本不能切换为root# error: more than one device/emulator #存在多个设备# # pull/push # > adb remount #重新挂载文件系统# > adb push file.txt /sdcard/ #将file.txt导入到sdcard中# > adb pull /sdcard/file.txt . #将/sdcard/file.txt导出到当前文件夹# # install/uninstall # > adb install -r app.apk #(重新)安装app.apk# # reboot # > adb reboot #重启# > adb reboot bootloader #重启并进入fastboot模式# # ADB SHELL命令 # > adb shell $ su #切换为root# ------------------------ (1)getevent > adb shell getevent -p #获取所有input event设备的属性# > adb shell getevent -l #实时显示所有events# > adb shell] $ su # getevent -l > /sdcard/event.txt #将getevent的结果保存到/sdcard/event.txt中# (2)sendevent set KEY_HOMEPAGE=172 set KEY_HOME=3 set KEY_BACK=4 set KEY_UP=19 set KEY_DOWN=20 set KEY_LEFT=21 set KEY_RIGHT=22 set KEY_OK=23 set KEY_VOL_PLUS=24 set KEY_VOL_MINUS=25 set KEY_MENU=82 set KEY_DELETE=67 set KEY_CLEAR=28 set KEY_POWER=116 set EV_KEY=1 set EV_SYN=0 set EV_ABS=3 set SYN_MT_REPORT=2 set SYN_REPORT=0 #adb shell模拟发送KEY_HOME键# > adb shell sendevent /dev/input/event0 EV_KEY KEY_HOME 1 > adb shell sendevent /dev/input/event0 EV_KEY KEY_HOME 0 > adb shell sendevent /dev/input/event0 EV_SYN SYN_REPORT 0 (3)input keyevent > adb shell input keyevent KEY_POWER #模拟按下电源键# (4)input swipe > adb shell input swipe 10 10 100 100 #模拟从点(10,10)划到(100,100)# (5)input tap > adb shell input tap 200 300 #模拟点击点(200,300)# (6)input text > adb shell input text no_space_line #发送一个没有空白字符的字符串# (7)截屏 > adb shell /system/bin/screencap -p /sdcard/screen.png (8)查看信息 > adb shell cat /proc/cpuinfo #查看CPU信息# > adb shell cat /proc/meminfo #查看内存信息# > adb shell cat /proc/bus/usb/devices #查看USB设备# > adb shell cat /proc/bus/input/devices #查看键盘和鼠标# > adb shell df #查看分区# > adb shell cat /proc/interrupts #查看中断#
转载请注明原文地址: https://www.6miu.com/read-6103.html

最新回复(0)