0
点赞
收藏
分享

微信扫一扫

adb和logcat常用命令


adb的作用

adb构成

  • client端,在电脑上,负责发送adb命令
  • daemon守护进程adbd,在手机上,负责接收和执行adb命令
  • server端,在电脑上,负责管理client和daemon之间的通信

adb工作原理

  • client端将命令发送给server端
  • server端会将命令发送给daemon端
  • daemon端进行执行
  • 将执行结果,返回给server端
  • server端将结果再返回给client端

常用命令

adb/adb help/adb --help

adb version

显示adb版本和路径

adb start-server

启动server

adb kill-server

停止server

adb devices

显示连接的设备列表

adb install xxx.apk

通过adb安装app

adb install -r xxx.apk

覆盖安装

adb uninstall 包名

通过adb卸载app

adb push xxx xxx

推送电脑的文件到手机

adb pull xxx xxx

拉取手机的文件到电脑

adb pull xxx

adb shell

进入到手机的Linux控制台

adb -s 设备名 shell

多设备时,指定设备

logcat

常用选项

adb logcat -help

查看帮助

adb logcat

常规显示

adb logcat -c

清除日志

adb logcat -g

显示缓冲区大小

adb logcat -G 256M

修改缓冲区大小

adb logcat -v time

设置不同的显示格式

adb logcat -V color

带颜色的显示

ctrl+c

强制中断程序的执行

通过tag过滤日志

adb logcat -s xxxxxx

根据pid过滤日志

ps -A | grep xxxxx 先获取进程PID
adb logcat | findstr 5544


举报

相关推荐

0 条评论