android adb 操作指令
基本命令
- adb devices
查找adb设备 - adb root
root android设备 - adb remount
重新挂载android设备 - adb shell
进入android shell - adb reboot
重启android设备
文件推送和下载
- adb push test.mp4 system/media/
推送指定的文件到设备 - adb pull system/media/test.mp4 D:\media
从设备上下载指定的文件到本地
软件包安装和卸载
- adb install test.apk
安装APK - adb install -r test.apk
覆盖安装APK - adb shell pm list packages
查看设备已安装应用包名, - adb uninstall com.ilitek.touchutility
卸载应用(需要对应应用包名)
input 事件
- adb shell input keyevent 4
触发返回事件 - adb shell input keyevent 3
触发Home按键 - adb shell input keyevent 24
音量增加 - adb shell input keyevent 25
音量减小 - adb shell input keyevent 164
扬声器静音 - adb shell input tap 500 1450
模拟触摸屏触摸事件 - adb shell input swipe 100 500 100 1450 100
模拟触摸屏滑动事件 - adb shell input swipe 100 500 100 500 250
模拟触摸屏长按事件 - adb shell input text “hello”
模拟输入文本
settings相关参数获取和设置
- adb shell settings get system screen_brightness
得到屏幕亮度 - adb shell settings put system screen_brightness 200
设置屏幕亮度为200(<255) - adb shell settings get system screen_off_timeout
得到显示屏休眠时间 - adb shell settings put system screen_off_timeout 600000
设置屏幕休眠时间 10分钟
打开关闭APP
- adb shell am start com.android.settings/com.android.settings.Settings
adb shell am start 包名/activity 打开应用的界面 - adb shell am force-stop com.android.settings
adb shell am force-stop 包名 关闭应用 - adb shell pm clear app com.android.settings
adb shell pm clear 包名 关闭应用
发送广播
- adb shell am broadcast -a android.intent.action.MASTER_CLEAR
发送“恢复出厂设置”广播 - adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
模拟开机广播,用来验证程序是不是会自启动 - adb shell am broadcast -a android.intent.action.SYSTEM_BAR_HIDE
隐藏状态栏和导航栏 - adb shell am broadcast -a android.intent.action.SYSTEM_BAR_SHOW
显示状态栏和导航栏
截屏录屏指令
- adb shell screencap -p /sdcard/01.png
截屏操作 - adb shell screenrecord /sdcard/demo.mp4
录屏操作
帮助指令
- adb shell lsmod --help
显示“lsmod”命令的帮助信息
其它
- ls 查看目录文件
- rm 删除
- cd 跳转到指定目录
- lsmod 查看加载的模块