查看能连接的设备
adb devices
连接自己想要的设备进入shell (xxxxxx)指自己的设备
adb -s xxxxxx shell
找到自己想要的对应第三方包名 -3 的意思是第三方包
adb shell pm list packages -3
将本地apk文件通过adb下载到设备 xxxx指自己电脑里面apk文件本地路径
adb install xxxx
查看应用安装路径 xxxx 指自己的包名
adb shell pm path xxxxx
清除应用数据与缓存 xxxx 指自己的包名
adb shell pm clear xxxx
卸载应用 xxxx 指自己的包名
adb uninstall xxxxxx
保存缓存数据卸载 xxxx 指自己的包名
adb uninstall -k xxxxx
在adb shell里面抓取某一个app的日志 xxx为包名的部分词 window为findstr linux为grep
adb logcat|grep xxxxx
设备截屏 保存到电脑 xxx代表自己想命名这张图片叫什么就叫什么
adb exec-out screencap -p > D:\image\kotlin\xxxx.png
录制屏幕需要先保存到设备,然后传输到电脑,目前很多已被回收了录制功能screenrecord
adb shell screenrecord /sdcard/xxxx.mp4
录制停止需要按 ctrl + c 默认录制时间和最长录制时间都是 180 秒
adb pull /sdcard/xxxx.mp4
如果进入日志页面,想退出 ctrl +c 就可以了
根据关键词过滤日志,比如我这里我只想要指定的包名的日志 xxx为自己包名的一部分词
adb logcat -e xxxx
退出shell环境
exit