查看包名
adb shell pm list packages 查找所有安装的应用包名
adb shell pm list packages "qq" 查找包含 qq 的应用的包名
查看安装路径
adb shell 进入
dumpsys package 包名 | grep codePath 查看安装包路径
adb shell pm list packages -f 查看安装包路径
adb shell pm path com.jzqf.flutterdemo 查看单个应用安装包路径
清除应用缓存
adb shell pm clear 包名
卸载应用
adb shell pm uninstall -k --user 0 packageName
这个命令的意思就是将用户 0 的 packageName 应用卸载掉。-k 表示保存数据,如不需要,可去掉 -k,--user 指定用户 id,Android 系统支持多个用户,默认用户只有一个,id=0。6、对于不常用或以后可能会用到的APP,可以使用 disable 进行禁用,需要时再 enable 即可(感谢 Zchon 的指点),命令如下:pm disable -k --user 0 packageName (禁用APP)pm enable -k --user 0 packageName (恢复APP)至此,系统预置的应用就被卸载了。部分情况下,有可能在设置 > 应用列表中看到“未针对此用户安装”的字样,这个没有影响,重启一下就没有了。亲测可以删除华为,小米手机自带浏览器等APP。
读写权限
adb root
adb remount
查看设备IP
adb shell ifconfig
adb shell netcfg
查看设备信息
adb shell cat /proc/meminfo 查看内存
adb shell free -h 查看内存
adb shell dumpsys iphonesubinfo 查看设备IMEI
adb shell cat /proc/cpuinfo 查看设备CPU信息
adb shell getprop ro.product.cpu.abi 查看cpu位数
adb shell wm size 查看分辨率
adb shell wm density 查看屏幕密度
adb shell dumpsys window displays 显示屏参数
adb shell getprop ro.build.version.release 设备系统版本
adb shell getprop ro.product.model 设备型号
adb shell pm list features 命令查看设备相机
adb shell dumpsys battery 设备电池信息
push文件到设备
adb root
adb remount
adb push PC文件路径 设备中文件要存放路径
pull文件
adb pull /sdcard/screenshot.png D:\360download\
查看应用信息
adb shell pm dump com.jzqf.xxxx | findstr "version" 查看应用版本
adb shell dumpsys package com.jzqf.xxxx 查看应用详情
adb shell dumpsys meminfo com.jzqf.xxxx 查看应用的内存
adb shell ps | findstr com.jzqf.xxxx 查看正在运行的进程
adb shell dumpsys activity services com.jzqf.xxxx 查看正在运行的服务
打开Activity
adb shell am start -n com.mida.messagehelper/com.mida.messagehelper.ui.activity.FlashActivity
adb shell am startservice -n com.jzqf.alive/.service.AliveService 启动服务
adb shell am start -a android.settings.SETTINGS # 打开系统设置页面
adb shell am start -a android.intent.action.DIAL -d tel:10086 # 打开拨号页面
adb shell am start -n com.android.mms/.ui.ConversationList # 打开短信会话列表
adb shell svc wifi enable 开启wifi
adb shell svc wifi disable 关闭wifi
adb shell svc data enable 开启移动数据
adb shell svc data disable 关闭移动数据
adb shell /system/bin/screencap -p /sdcard/screenshot.png 截屏
关闭应用
adb shell am force-stop 包名
发送广播
adb shell am broadcast -a com.jzqf.action.start
蓝牙
adb shell svc bluetooth enable
adb shell svc bluetooth disable
adb shell settings get global bluetooth_on
adb shell settings get secure bluetooth_address 查MAC
查看当前Activity
8.1之前
window 通过 adb shell dumpsys activity | findstr “mFocus”
Linux 通过 adb shell dumpsys activity | grep “mFocus”
8.1之后
window 通过 adb shell dumpsys activity | findstr “mResume”
Linux 通过 adb shell dumpsys activity | grep “mResume”
logcat日志
adb locat > D:\2021.txt 把日志输出到pc指定文件
adb logcat | find "xxxx" 按关键字过滤日志 windows上是find,linux上是grep
adb logcat TAG:d 按TAG关键字过滤,例如: adb logcat Test:d
5037端口占用
netstat -ano | findstr “5037”
tasklist | findstr “7392”
tasklist
任务管理杀掉此进程
adb kill-server 重启adb服务
adb start-server
模拟输入
adb shell input keyevent 4 返回键
adb exec-out screencap -p > sc.png 屏幕截图
adb shell screenrecord /sdcard/filename.mp4 录制屏幕
adb shell svc wifi enable 开启wifi
adb shell svc wifi disable 关闭WIFI
adb shell media volume --show --stream 3 --set 8 修改媒体音量,8为音量大小
adb shell media volume --stream 3 --get 查看媒体音量
adb shell input tap 50 250 在屏幕上点击坐标点x=50 y=250的位置。
刷机相关
adb reboot recovery 重启到 Recovery 模式
adb reboot 从 Recovery 重启到 Android
adb reboot bootloader 重启到 Fastboot 模式