adb 常用命令解析

查询设备列表
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
————————————————
版权声明:本文为CSDN博主「fin_123」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zouhui1003it/article/details/125214129

posted on 2022-08-08 10:59  帅胡  阅读(235)  评论(0编辑  收藏  举报

导航