adb 工作中常用命令

本文列举了多种adb命令,包括查看当前页面活动、获取设备信息、安装/卸载应用、查看应用日志以及管理应用状态等,这些是Android设备管理和应用开发调试中的常用操作。
摘要由CSDN通过智能技术生成

查看当前页面
adb shell "dumpsys activity | grep mFocusedActivity"   模拟器

adb shell getprop   获取已连接的设备的信息(获取appium参数)

adb shell dumpsys window | findstr mCurrentFocus   #查看手机当前运行APP包名
有以下方法可以查找到所需activity:

1.未安装的apk 启动activity可以使用AAPT命令

2.通过adb logcat >log.txt命令 -> 启动app -> Ctrol+C 结束日志 -> 在日志中查找 “Start proc”, 就可以查看到appPackage 和 appActivity

3.通过adb shell dumpsys activity|findstr "realActivity", 捉取到当前页面的activity

4.通过adb shell dumpsys window |findstr mCurrent,捉取当前页面的activity  可用

adb devices #查看连接设备

adb kill-server #在关闭adb服务后,要使用如下的命令启动adb服务

adb start-server #启动adb

adb -s cf27456f shell # 指定连接设备使用命令

adb install test.apk # 安装应用

adb install -r demo.apk #安装apk 到sd 卡:

adb -s 192.168.10.85 install -r   # 安装到指定手机、覆盖安装

adb uninstall cn.com.test.mobile #卸载应用,需要指定包

adb uninstall  com.szwl.wlaf   卸载爱感app

adb uninstall -k cn.com.test.mobile #卸载app 但保留数据和缓存文件

adb shell  //进入Shell 模式 

adb shell pm list packages #列出手机装的所有app 的包名

adb shell pm path (APP包名)#查看APP路径 

adb shell pm list packages -3 #列出除了系统应用的第三方应用包名

adb shell pm clear cn.com.test.mobile #清除应用数据与缓存

adb shell getprop ro.build.version.release --获取版本号

adb shell getprop net.bt.name     获取平台名

adb shell am start -ncn.com.test.mobile/.ui.SplashActivity #启动应用

adb shell dumpsys package #包信息Package Information

adb shell dumpsys meminfo #内存使用情况Memory Usage

adb shell am force-stop cn.com.test.mobile #强制停止应用

adb logcat #查看日志

adb logcat -v threadtime -> C:\Users\Administrator\Desktop\logcat.txt    打印日志

adb logcat -t 10  #查看手机日志

adb logcat | find “com.szwl.wlaf”  #抓取指定APP日志

adb logcat -v threadtime -> C:\Users\86199\Desktop\logcat.txt      保存日志

adb logcat -c #清除log 缓存

adb reboot #重启

adb get-serialno #获取序列号

netstat -ano|findstr 0.0.0.0:4723 查看占用线程在任务管理器中停止

adb shell  cat /sys/class/net/wlan0/address    查看mac地址

adb shell getprop ro.build.version.release #查看Android 系统版本

adb shell top -s 10 #查看占用内存前10 的app

adb push <local> <remote> #从电脑复制文件到设备

adb pull <remote> <local> #从设备复制文件到电脑

adb bugreport #查看bug 报告

adb install -r 替换已存在的应用程序,也就是说强制安装

adb install -l 锁定该应用程序

adb install -t 允许测试包

adb install -s 把应用程序安装到sd卡上

adb install -d 允许进行将见状,也就是安装的比手机上带的版本低

adb install -g 为应用程序授予所有运行时的权限

adb help #查看ADB 帮助

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值