adb 常用命令解析

测试开发社区

共 2272字,需浏览 5分钟

 ·

2022-06-13 01:19

查询设备列表
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
浏览 104
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报