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

相关推荐
2501_9151063233 分钟前
苹果软件加固与 iOS App 混淆完整指南,IPA 文件加密、无源码混淆与代码保护实战
android·ios·小程序·https·uni-app·iphone·webview
2501_9159214341 分钟前
iOS 26 崩溃日志解析,新版系统下崩溃获取与诊断策略
android·ios·小程序·uni-app·cocoa·iphone·策略模式
齊家治國平天下3 小时前
Android 14 Input 事件派发机制深度剖析
android·input·hal
2501_916013744 小时前
iOS 推送开发完整指南,APNs 配置、证书申请、远程推送实现与上架调试经验分享
android·ios·小程序·https·uni-app·iphone·webview
李艺为6 小时前
非预置应用使用platform签名并且添加了android.uid.system无法adb安装解决方法
android·adb
李宥小哥7 小时前
C#基础11-常用类
android·java·c#
Jerry12 小时前
Compose 中的绘制功能简介
android
我科绝伦(Huanhuan Zhou)14 小时前
【脚本升级】银河麒麟V10一键安装MySQL9.3.0
android·adb
消失的旧时光-194314 小时前
Android回退按钮处理方法总结
android·开发语言·kotlin