【汇总】android adb 命令功能大全

2024-07-06

前言全局说明

adb 命令是 Android 官方提供,调试 Android 系统的工具。

adb 全称为 Android Debug Bridge(Android 调试桥),是 Android SDK 中提供的用于管理 Android 模拟器或真机的工具。

adb 是一种功能强大的命令行工具,可让 PC 端与 Android 设备进行通信。adb 命令可执行各种设备操作,例如安装和调试应用,并提供对 Unix shell 的访问权限。

官方使用说明: https://adbshell.com/commands

官方下载说明;http://adbshell.com/downloads

一、基础命令

adb reboot #重启

adb help #查看ADB 帮助

二、查看设备

adb devices #查看可连接操作的设备

三、连接设备

adb [-d|-e|-s ]

连接指定设备

参数:

-d 指定当前唯一通过USB 连接的Android 设备为命令目标

-e 指定当前唯一运行的模拟器为命令目标

-s 指定相应serialNumber 号的设备/模拟器为命令目标

command 为所需对设备执行的命令

示例:

adb connect 127 0.0.1:7555 # 以 WLAN 网络方式连接(比如:连接电脑上模拟器 MUMU 等)

adb disconnect 127.0.0.1:16416 #断开连接

adb -s cf27456f shell # 指定连接设备使用命令,以USB、串口等方式连接真手机、平板等

四、安装、卸载APP应用

1.安装应用

adb install test.apk #安装应用

adb install -r demo.apk #保留数据和缓存文件,重新安装apk

adb install -s test.apk #安装apk 到sd 卡

2.卸载应用

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

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

-k: 卸载 APP 但保留数据和缓存文件

五、adb shell

5-1.adb shell

command 用途:

start [options] 启动 指定的 Activity

startservice [options] 启动 指定的 Service

broadcast [options] 发送 指定的广播

force-stop 停止 相关的进程

参数很灵活,和写 Android 程序时代码里的 Intent 相对应,用于决定 intent 对象的选项如下:

-a 指定 action,如android.intent.action.VIEW

-c 指定 category,如android.intent.category.APP_CONTACTS

-n 指定完整 component 名,用于明确指定启动哪个 Activity,

如: com.example.app/.ExampleActivity

5-1-1.adb shell am start

在Android中,除了从界面上启动程序之外,还可以从命令行启动程序,使用的是命令行工具am.

adb shell am start [options]

adb shell am start -n {包(package)名}/{包名}.

start an Activity: am start [-D]

-D: enable debugging

send a broadcast Intent: am broadcast

start an Instrumentation: am instrument [flags]

-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)

-e : set argument to

-p : write profiling data to

-w: wait for instrumentation to finish before returning

start profiling: am profile start

stop profiling: am profile stop

specifications include these flags:

[-a ] [-d ] [-t ]

[-c [-c ] ...]

[-e|--es ...]

[--ez ...]

[-e|--ei ...]

[-n ] [-f ] []

adb shell am start -n #指定完整 component 名,用于明确指定启动哪个Activity

adb shell am start -n com.tencent.mm/.ui.LauncherUI #表示调起微信主界面

adb shell am start -n com.tencent.mm/com.tencent.mm.ui.LauncherUI #表示调起微信主界面

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

adb shell am start -a android.intent.action.MAIN -n com.android.settings/com.android.settings.SubSettings #打开设置界面

adb shell am start -n com.android.browser/com.android.browser.BrowserActivity ## 打开Browser(浏览器)

adb shell am start -a android.intent.action.VIEW -d http://www.163.com/ ##浏览器打开指定网址

adb shell am start -a android.intent.action.VIEW http://www.qq.com/ ##浏览器打开指定网址

start 相关说明:https://blog.csdn.net/yegshun/article/details/80982404

5-1-2.adb shell am startservice

adb shell am startservice [options]

示例: 表示调起微信的某 Service 界面。

adb shell am startservice -n com.tencent.mm/com.tencent.mm.plugin.accountsync.model.AccountAuthenticatorService

adb shell am startservice -n com.tencent.mm/.plugin.accountsync.model.AccountAuthenticatorService

5-1-3.adb shell am broadcast

发送广播, 可以向所有组件广播,也可以只向指定组件广播。

adb shell am broadcast [options]

adb shell am broadcast -a [-d ] [-t ] [-c [-c ] ...]

-a参数指定广播的Action

-d参数指定广播的Data URI

-t参数指定广播的MIME类型

-c参数指定广播的Category

示例:

#向所有组件广播 BOOT_COMPLETED (开机广播)

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED

#如:只向 org.mazhuang.boottimemeasure/.BootCompletedReceiver 广播 BOOT_COMPLETED:

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -n org.mazhuang.boottimemeasure/.BootCompletedReceiver

系统预定义的广播(文字、图片版):

更多详细:https://www.cnblogs.com/wutou/p/17940047

5-1-4.adb shell am force-stop

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

adb shell am force-stop com.tencent.mm #强制停止微信

5-2.adb shell pm

5-2-1 adb shell pm list

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

adb shell pm list packages -s #列出系统应用的所有包名

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

adb shell pm list packages | find "test" #win 列出手机装带有的test的包

adb shell pm list packages | grep ‘test’ #linux 列出手机装带有的test的包

5-2-2 adb shell pm clear

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

5-3.adb shell dumpsys

Dumpsys用户系统诊断,它运行在设备上,并提供系统服务状态信息

更详细用法:https://www.cnblogs.com/xiaowenshu/p/10390246.html

5-3-1.adb shell dumpsys [options]

adb shell dumpsys package #包信息Package Information

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

adb shell dumpsys battery #电池状况

adb shell dumpsys window displays #显示屏参数

adb shell dumpsys window | findstr mCurrentFocus # 显示当前开启窗口名

adb shell dumpsys bluetooth_manager #查看蓝牙信息

adb shell dumpsys wifi #查看Wi-Fi 信息

adb shell dumpsys gfxinfo #APP界面的帧率

adb shell "dumpsys window | grep mCurrentFocus" # 查看前台显示的Activity界面

示例:

adb shell dumpsys package com.tencent.mm 显示微信包全部信息

adb shell dumpsys package com.jingdong.app.mall | findstr version ## 查看‘京东’安装包版本

5-3-2.adb shell dumpsys activity

adb shell dumpsys activity services [] #查看正在运行的Services

参数不是必须的,指定 表示查看与某个包名相关的Services,不指定表示查看所有Services。

不一定要给出完整的包名,比如运行adb shell dumpsys activity services org.zhihu,那么包名org.zhihu.demo1、org.zhihu.demo2 和org.zhihu 等相关的Services 都会列出来。

5-3-3.adb shell dumpsys iphonesubinfo

adb shell dumpsys iphonesubinfo #IMEI( Android 5.0 及以下有效)

#而在 Android 5.0 及以上版本里这个命令输出为空,得通过其它方式获取了(需要 root 权限):

adb shell

su

service call iphonesubinfo 1

5-3-4.adb shell dumpsys battery

adb shell dumpsys battery #显示电磁信息

adb shell "dumpsys battery | grep status" #只显示电池信息,包含status关键字的

adb shell "dumpsys battery | grep powered" #只显示电池信息,包含powered关键字的

因为在CMD 终端下执行命令 | 会被解析,所以把 "dumpsys battery | grep powered" 用双引号括起来

5-4.adb shell getprop/setprop

5-4-1.adb shell getprop

列出所有配置属性值

adb shell getprop ro.product.model #查看设备型号

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

adb shell getprop gsm.network.type #驻网类型

adb shell getprop gsm.operator.alpha #运营商类型

adb shell cat /system/build.prop | grep ro.product.cpu.abi # 获取CPU架构

adb shell cat /system/build.prop | find “ro.product.cpu.abi” # 获取CPU架构

adb shell getprop ro.product.cpu.abi # 获取CPU架构

查看设备信息

adb shell getprop ro.product.brand #设备品牌

adb shell getprop ro.product.board #设备处理器型号

adb shell dumpsys SurfaceFlinger|findstr "GLES" #设备引擎渲染模式

5-4-2.adb shell setprop

setprop [key] [value] 设置指定key的属性值

setprop service.adb.tcp.port 5555

5-5.adb shell top

使用方法:

top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ]

参数如下:

-m num 最多显示多少个进程

-n num 刷新多少次后退出

-d num 刷新时间间隔(单位秒,默认值 5)

-s col 按某列排序(可用 col 值:cpu, vss, rss, thr)

-t 显示线程信息

-h 显示帮助文档

示例:

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

5-6.adb shell wm

5-6-1.adb shell wm size

adb shell wm size #查看屏幕分辨率

adb shell wm size 480x1024 #将分辨率修改为 480px * 1024px

adb shell wm size reset #恢复原分辨率

5-6-2.adb shell wm density

adb shell wm density #查看屏幕密度

adb shell wm density reset #恢复原屏幕密度

5-6-3.adb shell wm overscan

显示区域

adb shell wm overscan # 四个数字分别表示距离左、上、右、下边缘的留白像素,以上命令表示将屏幕底部 100px留白

adb shell wm overscan reset #恢复显示区域

5-7.adb shell input

5-7-1.adb shell input keyevent

adb shell input keyevent

adb shell input keyevent 3 #HOME 键

adb shell input keyevent 4 #返回键

adb shell input keyevent 24 #增加音量

adb shell input keyevent 25 #降低音量

adb shell input keyevent 26 #电源键

adb shell input keyevent 82 #菜单键

adb shell input keyevent 85 #播放/暂停

adb shell input keyevent 86 #停止播放

adb shell input keyevent 87 #播放下一首

adb shell input keyevent 88 #播放上一首

adb shell input keyevent 126 #恢复播放

adb shell input keyevent 127 #暂停播放

adb shell input keyevent 164 #静音

adb shell input keyevent 224 #点亮屏幕

adb shell input keyevent 223 #熄灭屏幕

keycode位操作参数,不同的 keycode 能实现不同的功能

完整的功能见:https://developer.android.com/reference/android/view/KeyEvent.html

keycode 能实现不同的功能,对应的编码如下:

5-7-2.adb shell input swipe

adb shell input swipe 300 1000 300 500 #滑动解锁,向上滑动手势解锁

参数: 300 1000 300 500 分别表示起始点x坐标 起始点y坐标 结束点x坐标 结束点y坐标

5-7-3.adb shell input text

adb shell input text hello #焦点处于某文本框时输入文本hello

5-8.adb shell dmesg

adb shell dmesg #查看内核日志

5-9.adb shell settings

更详细说明:https://www.cnblogs.com/wutou/p/17945015

5-9-1.adb shell settings get

adb shell settings get secure android_id #android_id

adb shell settings get system screen_off_timeout #获取屏幕休眠时间

adb shell settings get global auto_time #获取日期时间选项中通过网络获取时间的状态,1为允许、0为不允许。更改该状态,从1改为0

adb shell settings get system screen_brightness #获取当前屏幕亮度值

adb shell settings get secure default_input_method io.appium.android.ime/.UnicodeIME #默认为Appium使用中文输入时安装的输入法

adb shell settings get secure default_input_method com.sohu.inputmethod.sogouoem/.SogouIME #默认搜狗输入法

adb shell settings get global http_proxy #查看代理是否设置成功

adb shell settings get global wifi_on #查看WiFi 状态。1:开 0:关

5-9-2.adb shell settings put

5-9-2-1.adb shell settings put system

adb shell settings put system screen_brightness 150 #更改亮度值(亮度值在0—255之间)

adb shell settings put system screen_off_timeout 600000 #设置屏幕休眠时间(毫秒)

adb shell settings put system screen_off_timeout 2147483647 #设置永不锁屏

adb shell settings put system accelerometer_rotation 0 #禁用屏幕自动旋转

adb shell settings put system accelerometer_rotation 1 #启用屏幕自动旋转

adb shell settings put system user_rotation 1 #屏幕旋转到横向模式

adb shell settings put system user_rotation 3 #屏幕旋转 270° clockwise

user_rotation后取值范围为0,1,2,3

5-9-2-2.adb shell settings put secure

adb shell settings put secure install_non_market_apps1 #允许安装来源

adb shell settings put secure location_providers_allowed +gps #开启GPS定位功能

adb shell settings put secure location_providers_allowed -gps #关闭GPS定位功能,或者移除定位服务提供者

adb shell settings put secure display_density_forced 440

5-9-2-3.adb shell settings put global

adb shell settings put global policy_control

可由如下几种键及其对应的值组成,格式为 =:=

key 键对应的值:

这些键对应的值可则如下值用逗号组合:

示例:

# 设置在所有界面下都同时隐藏状态栏和导航栏

adb shell settings put global policy_control immersive.full=*

# 设置在包名为 com.package1 和 com.package2 的应用里隐藏状态栏,在除了包名为 com.package3 的所有应用里隐藏导航栏。

adb shell settings put global policy_control immersive.status=com.package1,com.package2:immersive.navigation=apps,-com.package3

adb shell settings put global adb_enabled 0 #关闭 USB 调试模式。关闭后,使用命令无法恢复开启USB 调试模式,只能通过屏幕手动操作

adb shell settings put global captive_portal_detection_enabled 0 #关闭系统网络检查服务

adb shell settings put global captive_portal_detection_enabled 1 #开启还原网络检查服务

adb shell settings put global http_proxy 127.0.0.1:1984 #设置全局代理

adb shell settings put global http_proxy :0 #关闭代理(无需重启),只清空填写的IP和端口

adb shell settings put global http_proxy null #同上,关闭代理(因为必须要一个参数,所以写:0和null效果一样)

adb shell settings put global https_proxy 你电脑的IP:你抓包软件的监听端口 #设置https全局代理

adb shell settings put global global_http_proxy_exclusion_list 2.3.3.3,1.1.1.1 # (旧版)http代理排除 2.3.3.3 和 1.1.1.1(这两个网址不使用代理)

adb shell settings put global global_http_proxy_exclusion_list baidu.com,jd.com # (旧版)http代理排除 baidu.com和jd.com(这两个网址不使用代理)

adb shell settings put global global_http_proxy_exclusion_list null # (旧版)http代理排除列表,清空

adb shell settings delete global ProxyExclusionList # (旧版)http代理排除列表,清空

adb shell settings put global ProxyExclusionList 2.2.22.2 ## (新版)设置代理排除列表

adb shell settings get global ProxyExclusionList ## (新版)获取代理排除列表

adb shell settings put global install_non_market_apps 0 #禁止安装非市场应用

adb shell settings put global install_non_market_apps 1 #允许安装非市场应用

adb shell settings put global wifi_sleep_policy 2 #屏幕关闭时,设置WiFi在屏幕关闭时始终保持连接

adb shell settings put global ntp_server asia.pool.ntp.org #设置NTP服务器为亚洲地区的服务器

设置后的配置文件路径:

老版本,文件路径:/data/system/users/0/settings_global.xml

文件路径:/data/misc/apexdata/com.android.wifi/MuMuWifiConfigStore.xml

https://www.cnblogs.com/wutou/p/18175319

飞行模式开启后,就可以发送广播,来更改飞行模式的状态:

adb shell settings put global airplane_mode_on 1

adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true

飞行模式关闭:

adb shell settings put global airplane_mode_on 0

adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false

动画缩放

adb shell settings put global window_animation_scale 0 #关闭窗口动画缩放

adb shell settings put global transition_animation_scale 0 # 关闭过渡动画缩放:

adb shell settings put global animator_duration_scale 0 #关闭动画持续时间缩放

5-9-3.adb shell settings delete

示例:

adb shell settings delete global http_proxy #取消代理

adb shell settings delete global global_http_proxy_host #取消代理

adb shell settings delete global global_http_proxy_port #取消代理端口

adb shell settings delete global captive_portal_server #开启还原网络检查服务

5-9-4.adb shell settings list

5-9-4-1.adb shell settings list system

系统设置

示例:

adb shell "settings list system | grep timeout" #获取自动锁屏时间

5-9-4-2.adb shell settings list secure

安全设置

示例:

5-9-4-3.adb shell settings list global

全局设置

示例:

5-9-5.adb shell settings reset

5-9-5.adb shell settings reset global

示例:

adb shell settings reset global http_proxy #代理恢复默认(取消代理)

5-10.adb shell ifconfig

获取 IP 地址

adb shell ifconfig | find “Mask”

adb shell ifconfig wlan0 #设备连着 WiFi,可以使用如下命令来查看局域网 IP

adb shell netcfg # 上面两个无结果可以用这个,查看网络连接状态

5-11.adb shell $(运行Linux命令)

adb shell "cat /sys/class/net/wlan0/address" # 获取 Mac 地址,设备不同可能地址不同

adb shell "cat /proc/cpuinfo" #获取 CPU 信息

adb shell "cat /proc/meminfo" #获取 内存信息

adb shell "cat /system/build.prop" #获取 更多硬件与系统属性

adb shell "cat /data/misc/wifi/*.conf" #查看连接过的 WiFi 密码。需要 root 权限

adb shell "date -s 20190531.131600" #将系统日期和时间更改为 2019 年 05 月 31 日 13 点 16 分 00 秒。需要 root 权限。"

adb shell "cat /proc/net/wireless | grep wlan0 | awk '{print $3}'" #获取信号强度

adb shell "cat /proc/net/wireless | grep wlan0 | awk '{print 5}'" #获取信号质量:单位dBm

adb shell "iwconfig wlan0 | sed 's/ /\n/g' | grep -i Rate | sed 's/=/ /g'|awk '{print $2}'" #网口的传输速率:Mb/s = 1000000bps

5-12.adb shell screencap

5-12-1.老版本截屏

adb shell screencap -p /sdcard/img.png #老版本截图先保存在设备端

adb pull /sdcard/img.png # 通过pull拷贝到本地

screencap 参数:

-p 指定保存文件为 png 格式

-d display-id 指定截图的显示屏编号(有多显示屏的情况下)

5-12-2.新版本截屏

adb exec-out screencap -p > img.png #老版本无exec-out命令,只适合于新版的截图

更详细,查看第八项

5-13.adb shell screenrecord

录制屏幕

adb shell screenrecord /sdcard/filename.mp4

screenrecord 参数:

--size WIDTHxHEIGHT 视频的尺寸,比如 1280x720,默认是屏幕分辨率。

--bit-rate RATE 视频的比特率,默认是 4Mbps。

--time-limit TIME 录制时长,单位秒。默认录制时间和最长录制时间都是180s。

--verbose 输出更多信息。

5-14.检测设备是否已 root

adb shell

su

此时命令行提示符是 $ 则表示没有 root 权限,是 # 则表示已 root。

5-15.adb shell monkey

Monkey 可以生成伪随机用户事件来模拟单击、触摸、手势等操作,可以对正在开发中的程序进行随机压力测试。

adb shell monkey -p -v 500 # 向 指定的应用程序发送 500 个伪随机事件

monkey 官方文档 https://developer.android.com/studio/test/monkey.html

5-16.adb shell svc

5-16-1.adb shell svc wifi

adb root

adb shell svc wifi enable #开启 WiFi。需要 root 权限。

adb shell svc wifi disable #关闭 WiFi。需要 root 权限

adb shell svc data enable/disadle #数据开关

5-17.adb shell ps

adb shell ps #查看进程

5-18.adb shell -c

-c :不进入终端的命令行执行命令

adb shell su -c setprop service.adb.tcp.port 5555 #以root用户执行,添加端口的命令

su :获取root权限

-c setprop service.adb.tcp.port 5555 :获取root命令后,执行向/system/build.prop文件中添加端口

5-19.adb shell getevent

输出所有event设备的基本信息

adb shell getevent --help #帮助

adb shell getevent #输出所有event设备的基本信息

adb shell getevent -c 10 #输出10条信息后退出

adb shell getevent -l #将type、code、value以对应的常量名称显示

adb shell 'getevent -p grep -E "0035|0036"' #屏幕

输出格式:设备名 事件type 事件code 事件value

getevent输出的是16进制,sendevent使用的是10进制,注意转换。

5-20.adb shell sendevent

设置event设备的基本信息

adb shell sendevent --help #帮助

adb shell sendevent #设置event设备的基本信息

5-21.adb shell service

服务

adb shell service call phone 3 #挂断电话

5-22.adb shell setenforce

selinux 使用 setenforce 命令进行设置

adb shell setenforce 0 #设置成permissive 模式

adb shell setenforce 1 #设置成enforce 模式

设置SELinux 成为permissive模式 临时关闭selinux的。在eng/userdebug版本中

注意此方法重启后失效

5-23.adb shell content

旋转屏幕

adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0 #禁用自动旋转

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1 #旋转屏幕

i后面跟的不同的值代表旋转为不同的方向,取值范围为0,1,2,3

需要root权限

5-24.adb shell ip addr show

显示网络ip地址

adb shell ip addr show # 显示网络IP

adb shell ip addr show wlan0 #显示无线网卡IP

adb shell ip addr show eth0 #显示有线网卡IP

5-25.adb shell recovery

恢复出厂设置的操作

注意:这是个危险的命令,不要在手机里操作,除非你知道在干什么

注意:这是个危险的命令,不要在手机里操作,除非你知道在干什么

注意:这是个危险的命令,不要在手机里操作,除非你知道在干什么

adb shell recovery --wipe_data #恢复出厂设置的操作

5-26. adb shell 重定向shell脚本文件名

adb shell < shell_script.sh

shell_script.sh 里写的是shell命令,这样多条命令或shell就可以直接执行了

5-*.

5-*.

六、上传、下载文件

adb push #从本地复制文件到设备

adb pull #从设备复制文件到本地

七、adb logcat

adb logcat [

7-1.adb logcat

adb logcat #查看日志

7-2.adb logcat -c

adb logcat -c #清除log 缓存

7-3.adb logcat -v

adb logcat -v 指定日志输出格式

adb logcat -v brief #默认格式,/():

adb logcat -v process #()

adb logcat -v tag #/:

adb logcat -v raw #

adb logcat -v time # /():

adb logcat -v threadtime # :

adb logcat -v long #[ : /:]

adb logcat -v long ActivityManager:I *:S #指定格式可与上面的过滤同时使用

7-4.adb logcat * : *

按某级别过滤日志则会将该级别及以上的日志输出,Android 日志的优先级如下:

V —— Verbose(最低,过滤少,输出得最多)

D —— Debug

I —— Info

W —— Warning

E —— Error

F —— Fatal

S —— Silent(最高,过滤多,啥也不输出)

示例:输出W之上的日志,W,E,F,S

adb logcat *:W

按 tag 和级别过滤日志: 可以由多个 [:priority] 组成

示例:

输出 tag ActivityManager 的 I 以上级别日志,输出tag MyApp的D 以上级别日志,及其它 tag 的 S 级别日志(即屏蔽其它 tag 日志)。

adb logcat ActivityManager:I MyApp:D *:S

7-5: 获取已安装应用Activity类名

旧版:

adb logcat ActivityManager:I *:s | findstr "cmp"

新版:

adb logcat ActivityManager:I *:s | findstr "pre-top-activity"

下图{}花括号里就是类名

类名启动设置:

adb shell am start -n com.android.settings/com.android.settings.Settings

类名关闭设置:

adb shell am force-stop com.android.settings

八、adb get-serialno

adb get-serialno #获取序列号

九、adb bugreport

adb bugreport #查看bug 报告

十、adb exec-out

执行命令并输出到本地。

10-1.adb exec-out screencap

adb exec-out screencap -p > img.png # 老版本无exec-out命令,只适合于新版的截图

十一、adb 自身管理

11-1. 启动停止服务

adb start-server #启动adb 服务,基本不会用到,因为只要设备连接正确,会自动启动adb server

adb kill-server #停止adb server

adb -P start-server #指定adb server 的网络端口port (默认为5037)启动服务

11-2.系统更新

11-2-1.重启到 Recovery 模式

adb reboot recovery

在设备的 Recovery 界面上操作进入 Apply update-Apply from ADB。

注:不同的 Recovery 菜单可能与此有差异,有的是一级菜单就有 Apply update from ADB。

11-2-2.重启到 Fastboot 模式

adb reboot bootloader

11-2-3.通过 adb 上传和更新系统。

adb sideload

十二、命令行切换到root权限

12-1.方式一:

adb comnnect IP:端口

adb root

12-2.方式二:

adb comnnect IP:端口

adb shell

$su

12-3.方式三:

adb comnnect IP:端口

adb shell

$su -

十三、连接

13.1 adb 等待设备连接:

#adb wait-for-device

eg://windows运行工具指令如下:

识别并连接设备后输出devices信息

#adb wait-for-device

#adb devices

此时命令行提示符是 $ 则表示没有 root 权限,是 # 则表示已 root。

免责声明:本号所涉及内容仅供安全研究与教学使用,如出现其他风险,后果自负。

参考、来源:

https://blog.csdn.net/y281252548/article/details/130619040

https://zhuanlan.zhihu.com/p/605831031 (adb 详细介绍)

https://blog.csdn.net/zh6526157/article/details/129583527 (adb shell am broadcast 广播介绍)

https://blog.51cto.com/u_16213586/8478014 (adb shell -c 不登录在终端执行命令)

https://blog.csdn.net/mazhidong/article/details/79412073

http://www.taodudu.cc/news/show-6122139.html?action=onClick

https://www.jianshu.com/p/11a201e705ac

https://blog.csdn.net/userwyh/article/details/82430665

https://www.jianshu.com/p/bae933aac556

https://blog.csdn.net/fxdaniel/article/details/45846333

https://blog.csdn.net/zh6526157/article/details/132495569

https://sspai.com/post/33696

https://blog.51cto.com/u_16087831/6223245

https://blog.csdn.net/luckywang1103/article/details/76804856

https://baijiahao.baidu.com/s?id=1756775420151725732&wfr=spider&for=pc

https://blog.51cto.com/u_16175448/6833996

https://cloud.tencent.com/developer/article/1360063

https://blog.csdn.net/zh6526157/article/details/134440688 (发送一个广播来更改飞行模式的状态)

https://blog.51cto.com/u_16213430/8410476

https://www.codenong.com/25864385/

https://www.jianshu.com/p/8a52eb8771e5

《Python3网络爬虫开发实战 第2版》崔庆才 P667

https://mumu.163.com/help/20230504/35047_1086360.html#a7 (查看设备信息)

https://doc.miyun.app/android-emulator-proxy

https://mumu.163.com/help/20210513/35047_947512.html (显示当前UI窗口名、获取已安装应用Activity类名)

https://www.cnblogs.com/dengqing9393/p/7210479.html (am说明)

https://www.cnblogs.com/dengqing9393/p/7210479.html (adb 打开浏览器)

https://www.cnblogs.com/greatverve/archive/2012/02/10/android-am.html (adb 打开浏览器)

https://www.52pojie.cn/thread-1505329-1-1.html (https_proxy)

https://www.52pojie.cn/thread-1600980-1-1.html (cmd 重定向shell脚本执行)

https://blog.csdn.net/liaochaoyun/article/details/122085681 (adb devices)