adb devicestools.adb-command-reference.categories.connection
列出当前已连接的全部 Android 设备及其状态。
tools.adb-command-reference.labels.syntax
adb devices [-l]tools.adb-command-reference.labels.example
adb devices -l-l 显示型号、传输 ID 等更详细信息。
adb connecttools.adb-command-reference.categories.connection
通过 TCP/IP 方式连接到指定设备(需先开启网络调试)。
tools.adb-command-reference.labels.syntax
adb connect <host>[:port]tools.adb-command-reference.labels.example
adb connect 192.168.1.20:5555默认端口 5555;Android 11+ 可使用配对码。
adb disconnecttools.adb-command-reference.categories.connection
断开指定的 TCP/IP 设备连接,省略地址则断开全部。
tools.adb-command-reference.labels.syntax
adb disconnect [host[:port]]tools.adb-command-reference.labels.example
adb disconnect 192.168.1.20:5555adb pairtools.adb-command-reference.categories.connection
Android 11+ 无线调试配对,用于首次建立可信连接。
tools.adb-command-reference.labels.syntax
adb pair <host>:<port>tools.adb-command-reference.labels.example
adb pair 192.168.1.20:37123需在设备开发者选项的“无线调试”中获取配对码。
adb tcpiptools.adb-command-reference.categories.connection
将设备的 adb 切换为 TCP/IP 监听模式,便于后续无线连接。
tools.adb-command-reference.labels.syntax
adb tcpip <port>tools.adb-command-reference.labels.example
adb tcpip 5555执行前请先用 USB 连接设备。
adb usbtools.adb-command-reference.categories.connection
将 adb 切换回 USB 监听模式,关闭网络调试。
tools.adb-command-reference.labels.syntax
adb usbtools.adb-command-reference.labels.example
adb usbadb kill-servertools.adb-command-reference.categories.connection
强制结束本地 adb server 进程,常用于连接异常时重置。
tools.adb-command-reference.labels.syntax
adb kill-servertools.adb-command-reference.labels.example
adb kill-serveradb start-servertools.adb-command-reference.categories.connection
启动本地 adb server 进程,多数命令会自动触发。
tools.adb-command-reference.labels.syntax
adb start-servertools.adb-command-reference.labels.example
adb start-serveradb -stools.adb-command-reference.categories.connection
在多设备场景下通过序列号指定目标设备执行命令。
tools.adb-command-reference.labels.syntax
adb -s <serial> <command>tools.adb-command-reference.labels.example
adb -s emulator-5554 shell pm list packages可结合 adb devices 获取序列号。
adb wait-for-devicetools.adb-command-reference.categories.connection
阻塞当前命令,直到至少有一台设备连接到 adb。
tools.adb-command-reference.labels.syntax
adb wait-for-device [next-command]tools.adb-command-reference.labels.example
adb wait-for-device shell getprop ro.product.model常用于自动化脚本中等待设备就绪。
adb versiontools.adb-command-reference.categories.device
查看本机 adb 客户端的版本号与协议版本。
tools.adb-command-reference.labels.syntax
adb versiontools.adb-command-reference.labels.example
adb versionadb get-statetools.adb-command-reference.categories.device
获取设备当前状态,如 device、bootloader、offline。
tools.adb-command-reference.labels.syntax
adb get-statetools.adb-command-reference.labels.example
adb get-stateadb get-serialnotools.adb-command-reference.categories.device
查询当前设备的序列号。
tools.adb-command-reference.labels.syntax
adb get-serialnotools.adb-command-reference.labels.example
adb get-serialnoadb shell getproptools.adb-command-reference.categories.device
读取 Android 系统属性,可获取型号、版本、SDK 等信息。
tools.adb-command-reference.labels.syntax
adb shell getprop [name]tools.adb-command-reference.labels.example
adb shell getprop ro.build.version.release不带参数会列出全部属性。
adb shell dumpsys batterytools.adb-command-reference.categories.device
查看电池电量、温度、是否充电等详细状态。
tools.adb-command-reference.labels.syntax
adb shell dumpsys batterytools.adb-command-reference.labels.example
adb shell dumpsys batteryadb shell dumpsys meminfotools.adb-command-reference.categories.device
查看进程内存占用,可定位内存泄漏。
tools.adb-command-reference.labels.syntax
adb shell dumpsys meminfo [package|pid]tools.adb-command-reference.labels.example
adb shell dumpsys meminfo com.android.chromeadb shell wm sizetools.adb-command-reference.categories.device
查看或修改设备屏幕分辨率。
tools.adb-command-reference.labels.syntax
adb shell wm size [WxH|reset]tools.adb-command-reference.labels.example
adb shell wm size 1080x1920reset 可恢复默认分辨率。
adb shell wm densitytools.adb-command-reference.categories.device
查看或修改屏幕像素密度(dpi)。
tools.adb-command-reference.labels.syntax
adb shell wm density [dpi|reset]tools.adb-command-reference.labels.example
adb shell wm density 320adb installtools.adb-command-reference.categories.app
向设备安装 APK,支持升级、降级、保留数据等选项。
tools.adb-command-reference.labels.syntax
adb install [-r|-t|-d|-g] <apk>tools.adb-command-reference.labels.example
adb install -r app-release.apk-r 覆盖安装;-t 允许测试包;-d 允许降级;-g 自动授予权限。
adb install-multipletools.adb-command-reference.categories.app
一次安装多个 APK,常用于 Split APK / AAB。
tools.adb-command-reference.labels.syntax
adb install-multiple [选项] <apk...>tools.adb-command-reference.labels.example
adb install-multiple base.apk config.armeabi_v7a.apkadb uninstalltools.adb-command-reference.categories.app
卸载指定包名的应用。
tools.adb-command-reference.labels.syntax
adb uninstall [-k] <package>tools.adb-command-reference.labels.example
adb uninstall com.example.app-k 保留应用数据和缓存。
adb shell pm list packagestools.adb-command-reference.categories.app
列出设备上的所有应用包名。
tools.adb-command-reference.labels.syntax
adb shell pm list packages [-3|-s|-f]tools.adb-command-reference.labels.example
adb shell pm list packages -3-3 仅第三方应用;-s 仅系统应用;-f 显示 APK 路径。
adb shell pm pathtools.adb-command-reference.categories.app
获取指定包名应用的 APK 安装路径。
tools.adb-command-reference.labels.syntax
adb shell pm path <package>tools.adb-command-reference.labels.example
adb shell pm path com.android.chromeadb shell pm cleartools.adb-command-reference.categories.app
清除应用的全部数据与缓存,相当于卸载重装。
tools.adb-command-reference.labels.syntax
adb shell pm clear <package>tools.adb-command-reference.labels.example
adb shell pm clear com.example.appadb shell pm disable-usertools.adb-command-reference.categories.app
为当前用户禁用指定应用,常用于停用系统应用。
tools.adb-command-reference.labels.syntax
adb shell pm disable-user [--user <id>] <package>tools.adb-command-reference.labels.example
adb shell pm disable-user --user 0 com.example.bloat对应 pm enable 可重新启用。
adb shell am starttools.adb-command-reference.categories.app
通过 Activity Manager 启动一个 Activity。
tools.adb-command-reference.labels.syntax
adb shell am start [-n component|-a action]tools.adb-command-reference.labels.example
adb shell am start -n com.android.settings/.Settingsadb shell am force-stoptools.adb-command-reference.categories.app
强制停止指定包名的应用进程。
tools.adb-command-reference.labels.syntax
adb shell am force-stop <package>tools.adb-command-reference.labels.example
adb shell am force-stop com.example.appadb shell am broadcasttools.adb-command-reference.categories.app
发送一个广播 Intent,常用于触发组件逻辑或测试。
tools.adb-command-reference.labels.syntax
adb shell am broadcast -a <action> [extras]tools.adb-command-reference.labels.example
adb shell am broadcast -a android.intent.action.BOOT_COMPLETEDadb shell monkeytools.adb-command-reference.categories.app
向应用发送伪随机事件,做压力或稳定性测试。
tools.adb-command-reference.labels.syntax
adb shell monkey [选项] -p <package> <count>tools.adb-command-reference.labels.example
adb shell monkey -p com.example.app -v 500adb pushtools.adb-command-reference.categories.file
把本地文件或目录上传到设备指定路径。
tools.adb-command-reference.labels.syntax
adb push <local> <remote>tools.adb-command-reference.labels.example
adb push ./config.json /sdcard/Download/目标路径需有写权限,必要时用 root 或换到 /sdcard。
adb pulltools.adb-command-reference.categories.file
把设备上的文件或目录拉取到本地。
tools.adb-command-reference.labels.syntax
adb pull <remote> [local]tools.adb-command-reference.labels.example
adb pull /sdcard/DCIM/Camera ./photosadb synctools.adb-command-reference.categories.file
增量同步本机构建产物到设备相应目录(system/vendor/data)。
tools.adb-command-reference.labels.syntax
adb sync [分区]tools.adb-command-reference.labels.example
adb sync data通常用于平台开发,使用前需 adb root + adb remount。
adb shell lstools.adb-command-reference.categories.file
列出设备目录下的文件与子目录。
tools.adb-command-reference.labels.syntax
adb shell ls [-l|-a] <path>tools.adb-command-reference.labels.example
adb shell ls -l /sdcard/adb shell rmtools.adb-command-reference.categories.file
删除设备上的文件或目录,请谨慎使用。
tools.adb-command-reference.labels.syntax
adb shell rm [-r|-f] <path>tools.adb-command-reference.labels.example
adb shell rm -rf /sdcard/Download/tmpadb shell cptools.adb-command-reference.categories.file
复制设备内部的文件或目录。
tools.adb-command-reference.labels.syntax
adb shell cp [-r] <src> <dst>tools.adb-command-reference.labels.example
adb shell cp /sdcard/a.txt /sdcard/b.txtadb shell mvtools.adb-command-reference.categories.file
移动或重命名设备上的文件、目录。
tools.adb-command-reference.labels.syntax
adb shell mv <src> <dst>tools.adb-command-reference.labels.example
adb shell mv /sdcard/a.log /sdcard/old/a.logadb shell mkdirtools.adb-command-reference.categories.file
在设备上创建目录,可递归创建多层。
tools.adb-command-reference.labels.syntax
adb shell mkdir [-p] <dir>tools.adb-command-reference.labels.example
adb shell mkdir -p /sdcard/MyApp/cacheadb logcattools.adb-command-reference.categories.log
查看设备的系统及应用日志,是排查问题的核心工具。
tools.adb-command-reference.labels.syntax
adb logcat [选项] [filterspec]tools.adb-command-reference.labels.example
adb logcat *:E*:E 仅显示错误;-s TAG 按标签过滤;-c 清空缓冲区。
adb logcat -ctools.adb-command-reference.categories.log
清空设备上的所有 logcat 日志缓冲区。
tools.adb-command-reference.labels.syntax
adb logcat -ctools.adb-command-reference.labels.example
adb logcat -cadb logcat -dtools.adb-command-reference.categories.log
导出当前已缓存的日志后立即退出。
tools.adb-command-reference.labels.syntax
adb logcat -dtools.adb-command-reference.labels.example
adb logcat -d > device.logadb logcat -vtools.adb-command-reference.categories.log
指定日志输出格式,如 time、threadtime、long。
tools.adb-command-reference.labels.syntax
adb logcat -v <format>tools.adb-command-reference.labels.example
adb logcat -v threadtimeadb bugreporttools.adb-command-reference.categories.log
生成完整的 bug report 压缩包,包含日志、dumpsys、堆栈等。
tools.adb-command-reference.labels.syntax
adb bugreport [path]tools.adb-command-reference.labels.example
adb bugreport ./bugreport.zipadb shell dmesgtools.adb-command-reference.categories.log
查看内核环形缓冲区的日志信息。
tools.adb-command-reference.labels.syntax
adb shell dmesgtools.adb-command-reference.labels.example
adb shell dmesg | tail -n 100部分机型需要 adb root 才能读取。
adb shelltools.adb-command-reference.categories.shell
进入设备的交互式 shell,或一次性执行指定命令。
tools.adb-command-reference.labels.syntax
adb shell [command]tools.adb-command-reference.labels.example
adb shell不带参数会打开交互终端,输入 exit 退出。
adb shell input texttools.adb-command-reference.categories.shell
向当前输入框模拟键入文本。
tools.adb-command-reference.labels.syntax
adb shell input text <text>tools.adb-command-reference.labels.example
adb shell input text hello空格请用 %s,中文需切换输入法支持。
adb shell input keyeventtools.adb-command-reference.categories.shell
模拟按键事件,如返回、Home、音量等。
tools.adb-command-reference.labels.syntax
adb shell input keyevent <code>tools.adb-command-reference.labels.example
adb shell input keyevent 4常用:4 BACK、3 HOME、26 POWER、24/25 音量。
adb shell input taptools.adb-command-reference.categories.shell
在屏幕指定坐标模拟一次点击。
tools.adb-command-reference.labels.syntax
adb shell input tap <x> <y>tools.adb-command-reference.labels.example
adb shell input tap 500 1200adb shell input swipetools.adb-command-reference.categories.shell
模拟滑动手势,可控制时长实现长按。
tools.adb-command-reference.labels.syntax
adb shell input swipe <x1> <y1> <x2> <y2> [ms]tools.adb-command-reference.labels.example
adb shell input swipe 300 1000 300 200 200时长设大可作为长按事件。
adb shell settingstools.adb-command-reference.categories.shell
读取或写入系统设置(global/system/secure)。
tools.adb-command-reference.labels.syntax
adb shell settings [get|put] <ns> <key> [value]tools.adb-command-reference.labels.example
adb shell settings put global airplane_mode_on 1adb shell screencaptools.adb-command-reference.categories.screen
截取设备屏幕并保存为 PNG 图片。
tools.adb-command-reference.labels.syntax
adb shell screencap -p <path>tools.adb-command-reference.labels.example
adb shell screencap -p /sdcard/screen.png可结合 adb pull 一并取回到本地。
adb shell screenrecordtools.adb-command-reference.categories.screen
录制屏幕视频(Android 4.4+),保存为 MP4。
tools.adb-command-reference.labels.syntax
adb shell screenrecord [选项] <path>tools.adb-command-reference.labels.example
adb shell screenrecord --time-limit 30 /sdcard/demo.mp4默认最长 180 秒;--bit-rate 可调码率。
adb exec-out screencaptools.adb-command-reference.categories.screen
无中转文件直接将截图传到本地。
tools.adb-command-reference.labels.syntax
adb exec-out screencap -p > <local.png>tools.adb-command-reference.labels.example
adb exec-out screencap -p > screen.pngWindows 下需使用 PowerShell 或转用 adb shell + pull。
adb reboottools.adb-command-reference.categories.system
重启设备,可指定进入特殊模式。
tools.adb-command-reference.labels.syntax
adb reboot [bootloader|recovery|sideload]tools.adb-command-reference.labels.example
adb reboot recoverybootloader 进入 fastboot;sideload 用于线刷 zip。
adb roottools.adb-command-reference.categories.system
在支持的 ROM 上让 adbd 以 root 身份运行。
tools.adb-command-reference.labels.syntax
adb roottools.adb-command-reference.labels.example
adb root用户版系统通常不支持,需 userdebug/eng 版本。
adb unroottools.adb-command-reference.categories.system
退出 root 模式,让 adbd 回到普通用户权限。
tools.adb-command-reference.labels.syntax
adb unroottools.adb-command-reference.labels.example
adb unrootadb remounttools.adb-command-reference.categories.system
将系统分区重新挂载为可读写,常配合修改系统文件。
tools.adb-command-reference.labels.syntax
adb remounttools.adb-command-reference.labels.example
adb remount需先 adb root;A/B 机型可能需要 disable-verity。
adb disable-veritytools.adb-command-reference.categories.system
关闭系统分区的校验,使 remount 写入生效。
tools.adb-command-reference.labels.syntax
adb disable-veritytools.adb-command-reference.labels.example
adb disable-verity执行后通常需要 adb reboot。
adb enable-veritytools.adb-command-reference.categories.system
重新开启系统分区的 dm-verity 校验。
tools.adb-command-reference.labels.syntax
adb enable-veritytools.adb-command-reference.labels.example
adb enable-verityadb sideloadtools.adb-command-reference.categories.system
通过 recovery 模式向设备刷入 OTA 或完整 zip 包。
tools.adb-command-reference.labels.syntax
adb sideload <package.zip>tools.adb-command-reference.labels.example
adb sideload update.zip需先进入 recovery 并选择 “Apply update from ADB”。
adb backuptools.adb-command-reference.categories.system
备份设备数据为 .ab 文件(Android 6 后系统逐步弱化)。
tools.adb-command-reference.labels.syntax
adb backup [选项] [-f file]tools.adb-command-reference.labels.example
adb backup -all -f backup.ab高版本 Android 已不再推荐,请优先用 Google 备份。
adb restoretools.adb-command-reference.categories.system
将之前 adb backup 生成的 .ab 文件恢复回设备。
tools.adb-command-reference.labels.syntax
adb restore <file>tools.adb-command-reference.labels.example
adb restore backup.abadb forwardtools.adb-command-reference.categories.network
将本机端口转发到设备端口,常用于调试本地与设备通讯。
tools.adb-command-reference.labels.syntax
adb forward <local> <remote>tools.adb-command-reference.labels.example
adb forward tcp:8080 tcp:8080remote 支持 tcp、localabstract、jdwp 等。
adb forward --listtools.adb-command-reference.categories.network
列出当前 adb forward 已建立的全部端口映射。
tools.adb-command-reference.labels.syntax
adb forward --listtools.adb-command-reference.labels.example
adb forward --listadb forward --removetools.adb-command-reference.categories.network
移除指定的本机端口转发规则。
tools.adb-command-reference.labels.syntax
adb forward --remove <local>tools.adb-command-reference.labels.example
adb forward --remove tcp:8080adb reversetools.adb-command-reference.categories.network
将设备端口反向转发到本机端口,让 App 访问本地服务。
tools.adb-command-reference.labels.syntax
adb reverse <remote> <local>tools.adb-command-reference.labels.example
adb reverse tcp:3000 tcp:3000React Native / 调试本机 API 常用。
adb reverse --listtools.adb-command-reference.categories.network
查看当前设备反向端口转发列表。
tools.adb-command-reference.labels.syntax
adb reverse --listtools.adb-command-reference.labels.example
adb reverse --listadb reverse --removetools.adb-command-reference.categories.network
移除指定的设备到本机的反向端口转发。
tools.adb-command-reference.labels.syntax
adb reverse --remove <remote>tools.adb-command-reference.labels.example
adb reverse --remove tcp:3000adb shell ip addrtools.adb-command-reference.categories.network
查看设备各网络接口的 IP、MAC、状态。
tools.adb-command-reference.labels.syntax
adb shell ip addrtools.adb-command-reference.labels.example
adb shell ip addr show wlan0adb shell pingtools.adb-command-reference.categories.network
在设备端发起 ICMP 测试,判断网络连通性。
tools.adb-command-reference.labels.syntax
adb shell ping <host>tools.adb-command-reference.labels.example
adb shell ping -c 4 8.8.8.8adb jdwptools.adb-command-reference.categories.debug
列出可被 JDWP 调试器附加的 Java 进程 PID。
tools.adb-command-reference.labels.syntax
adb jdwptools.adb-command-reference.labels.example
adb jdwpadb shell toptools.adb-command-reference.categories.debug
实时查看设备进程的 CPU、内存占用。
tools.adb-command-reference.labels.syntax
adb shell top [-n <times>]tools.adb-command-reference.labels.example
adb shell top -n 1-m N 限制行数;可与 grep 联用过滤。
adb shell pstools.adb-command-reference.categories.debug
快照当前设备运行中的进程列表。
tools.adb-command-reference.labels.syntax
adb shell ps [-A|-T]tools.adb-command-reference.labels.example
adb shell ps -A | grep com.exampleadb shell dumpsystools.adb-command-reference.categories.debug
导出指定系统服务或全部服务的运行状态。
tools.adb-command-reference.labels.syntax
adb shell dumpsys [service]tools.adb-command-reference.labels.example
adb shell dumpsys activity activities常用服务:activity、package、power、window。
adb shell setproptools.adb-command-reference.categories.debug
设置系统属性,调试日志、调度等行为。
tools.adb-command-reference.labels.syntax
adb shell setprop <name> <value>tools.adb-command-reference.labels.example
adb shell setprop log.tag.MyTag VERBOSE部分属性需要 root;重启后可能失效。
adb shell am profiletools.adb-command-reference.categories.debug
对指定进程开启或停止 method tracing 性能采样。
tools.adb-command-reference.labels.syntax
adb shell am profile start|stop <process> [file]tools.adb-command-reference.labels.example
adb shell am profile start com.example /sdcard/trace.traceadb shell cmd activitytools.adb-command-reference.categories.debug
Android 7+ 提供的 activity 调试命令集,可控制睡眠、模式等。
tools.adb-command-reference.labels.syntax
adb shell cmd activity <subcmd>tools.adb-command-reference.labels.example
adb shell cmd activity start -n com.example/.MainActivity