adb工具指令大全(速速收藏常用adb命令)(1)

查看当前连接设备:

adb devices

adb -s 设备号 其他指令

举例:

adb -s devicel install xxx.apk

查看顶部Activity:

adb shell dumpsys activity | findstr "mFocusedActivity"

adb shell dumpsys activity | grep "mFocusedActivity"

查看日志:

adb logcat

安装apk文件:

adb install xxx.apk

adb install -r xxx.apk

adb install -r -t xxx.apk

卸载App:

adb uninstall com.zhy.app

adb uninstall -k com.zhy.app

传递文件:

adb push 文件名 手机端SDCard路径

例如:

adb push 帅照.jpg /sdcard/

adb pull /sdcard/xxx.txt

查看手机端安装的所有app包名:

adb shell pm list packages

启动Activity:

adb shell am start 包名/完整Activity路径

例如:

adb shell am start com.zhy.aaa/com.zhy.aaa.MainActivity

adb shell am start com.zhy.aaa/com.zhy.aaa.MainActivity -e name zhy

adb shell am start -a "android.intent.action,VIEW" -d "https://www.google.com"

发送广播:

adb shell am broadcast -a "broadcastactionfilter"

-如果需要携带参数(携带一个Intent,key为name):

adb shell am broadcast -a "broadcastactionfilter" -e name zhy

启动服务:

adb shell am startservice "com.zhy.aaa/com.zhy.aaa.MyService"

屏幕截图:

可以使用screencap命令来进行手机屏幕截图;

例如:

adb shell screencap /sdcard/screen.png

录制视频:

可以使用screenrecord[options] filename命令来录制屏幕视频;

例如:

adb shell screenrecord /sdcard/demo.mp4

,