Adb shell 命令整理

以Root权限运行

adb root

重启设备

adb reboot

重启到Recovery

adb reboot recovery

重启到Fastboot

adb reboot bootloader

查看设备列表

adb devices

截屏

adb shell screencap -p /sdcard/screenshot.png

录屏

adb shell screenrecord /sdcard/screenrecord.mp4

拉取文件到电脑

adb pull /sdcard/screenshot.png ~/Documents

推送文件到手机

adb push android_server /data/local/tmp

端口转发

adb forward [(远程端)协议:端口号 ] [(设备端)协议:端口号]

查看日志信息

adb logcat [|grep filter]

查看设备ip地址

adb shell netcfg

查看设备端口信息

adb shell netstat

查看设备中可被调试应用

adb jdwp

挂载System 

adb remount

查看CPU消耗情况

adb shell top

查看系统属性

adb shell getprop 属性值  (如查看CPU架构:ro.product.cpu.abi)

打开应用Activity

adb shell am start com.xx.xxxx/.XXActivity

以调试模式打开应用

adb shell am start -D -n com.xx.xxxx/.MainActivity

杀死指定包名进程

adb shell am force-stop com.xx.xxxx

启动服务

adb shell am startservice -n com.xx.xxx/com.xx.xxxx.xxservice

发送广播

adb shell am broadcast -a action datas (action:广播动作,datas:携带的数据)

查看指定包名的进程信息

adb shell ps | grep com.xx.xxxx

安装应用

adb install -r app.apk

卸载指定包名应用

adb uninstall com.xx.xxxx

查看应用列表

adb shell pm list package

清除指定包名应用信息

adb shell pm clear com.xx.xxxx

查看当前Activity

adb shell dumpsys window w | grep name=""

查看当前交互Activity

adb shell dumpsys activity | grep "mFocusedActivity"

查看activities栈

adb shell dumpsys activity activities

查看活动Activity

adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'

查看当前应用Activity信息

adb shell dumpsys activity top

查看指定包名的应用信息(AndroidManifest.xml)

adb shell dumpsys package com.xx.xxxx

查看指定进程名或者进程ID的应用内存信息

adb shell dumpsys meminfo [com.xx.xxxx|pid]

查看指定包名的应用的数据库信息

adb shell dumpsys dbinfo com.xx.xxxx

输入文本内容(中文不行)

adb shell input text xxxxxxx

删除输入框内容

adb shell input keyevent 67

模拟按键

adb shell input keyevent 键值(相应键值请自个查找)

模拟点击

adb shell input tap x y (x横坐标,y纵坐标)

模拟滑动

adb shell input touchscreen swipe startX startY endX endY

你可能感兴趣的:(Adb shell 命令整理)