代码改变世界

adb 常用命令解析

  zouhui  阅读(7)  评论(0编辑  收藏  举报  

查询设备列表
adb devices

安装应用app
adb install xx.apk

卸载应用app

adb uninstall [-k] <packagename>

查看安装的app包名

adb shell pm list packages 

查看前台 Activity

adb shell dumpsys activity activities | grep mFocusedActivity 

查看当前正在运行的APK的包名
adb shell dumpsys window | findstr mCurrentFocus

monkey app压测
adb shell monkey -p 包名 -v -v -v 200>D:AAlog.txt

app启动时间
adb shell am start com.android.settings/.HWSettings

通过wifi连接手机

adb connect 手机IP地址:5555

打开wifi页面命令
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings

打开蓝牙设置界面
adb shell am start -a android.settings.BLUETOOTH_SETTINGS

打开蓝牙开关
adb shell svc bluetooth enable

关闭蓝牙开关
adb shell svc bluetooth disable

拨打电话
adb shell am start -a android.intent.action.CALL tel:10086

挂断电话
adb shell input keyevent KEYCODE_ENDCALL

adb指定设备
adb -s 设备id <command>

打开手机卡页面
adb shell am start -a android.intent.action.MAIN -n com.android.phone/.settings.MobileNetworkSettings

打开手机通话页面
adb shell am start -a android.intent.action.MAIN -n com.android.contacts/.activities.TwelveKeyDialer

进入手机移动网络页面
adb -s AC9XKK shell am start -a android.intent.action.MAIN -n com.android.phone/com.android.phone.MobileNetworkSettings

增加音量:
adb shell input keyevent 24

降低音量:
adb shell input keyevent 25

播放/暂停:
adb shell input keyevent 85

停止播放:
adb shell input keyevent 86

滑动解锁
adb shell input swipe 300 1000 300 500

打开手机设置页面
adb shell am start com.android.settings/com.android.settings.Settings

指定程序内存使用情况

adb shell dumpsys meminfo $package 

指定程序CPU使用情况

adb shell dumpsys cpuinfo $package 

接收的数据流量

adb shell cat /proc/uid_stat/$PID/tcp_rcv 

发送的数据流量

adb shell cat /proc/uid_stat/$PID/tcp_snd 

指定程序电量消耗信息

adb shell dumpsys batterystats $package | more 

综合电量消耗

adb shell dumpsys batterystats | more 

电池信息

adb shell dumpsys battery 

查指定程序pid

adb shell "ps | grep $package" 


查看手机信息

adb shell getprop 

查看手机序列号

adb shell getprop ro.serialno 

查看手机CPU信息

adb shell cat /proc/cpuinfo 

查看手机内存信息

adb shell cat /proc/meminfo 

重启手机

apk adb reboot 

屏幕截图

adb shell screencap /sdcard/screen.png 

录制视频

adb shell screenrecord /sdcard/demo.mp4 

查看日志
adb logcat *:W

查看进程
adb shell ps

查看实时资源占用情况
adb shell top

点击Home按钮
adb shell input keyevent 3

输入文本
adb shell input text hello

传文件到电脑

adb pull /sdcard/test.flv /Users/fin/test.flv

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2020-06-09 用 Python 画一个捂脸表情
点击右上角即可分享
微信分享提示