获取Android设备号
adb shell getprop ro.serialno
获取系统版本
adb shell getprop ro.build.version.release
>4.2.2
获取系统api版本
adb shell getprop ro.build.version.sdk
>17
获取设备分辨率(SDK4.3)
adb shell wm size
获取设备屏幕密度(SDK4.3)
adb shell wm density
日志操作
#查看日志(实时显示)
>abd logcat -d
#清除日志
>adb logcat -c
截图操作
#截图保存至sdcard中
>adb shell screencap /sdcard/screencap.png
#将截图从sdcard中导出PC
>adb pull /sdcard/screencap.png
#删除sdcard中的截图
>adb shell rm /sdcard/screencap.png
#截图保存至PC
>adb shell screencap -p | sed 's/\r$//' > screen.png
#使用alias别名命令创建快捷命令
>alias screencap="adb shell screencap -p | sed 's/\r$//'"
>screencap > screen.png
视频录制
#录制视频
>adb screenrecode /sdcard/demo.p4
启动关闭应用
#启动指定activity
>adb shell am start -n packagename/activity
#关闭应用程序
>adb shell am force-stop packagename
清理应用数据
#清除应用程序数据
>adb shell pm clear packagename
adb shell input text "android"
adb shell input keyevent 4
Usage: input [<source>] <command> [<arg>...]
The sources are:
trackball
joystick
touchnavigation
mouse
keyboard
gamepad
touchpad
dpad
stylus
touchscreen
The commands and default sources are:
text <string> (Default: touchscreen)
keyevent [--longpress] <key code number or name> ... (Default: keyboard)
tap <x> <y> (Default: touchscreen)
swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
press (Default: trackball)
roll <dx> <dy> (Default: trackball)