We use cookies.This website uses essential cookies to operate core features. With your consent, we also use analytics cookies to understand traffic and improve the service. For more details, see our .
If this tool helped you, you can buy us a coffee ☕
Quick reference for essential Android Debug Bridge (ADB) commands. Easily look up commands for device connection, app management, logging, and debugging.
列出当前已连接的全部 Android 设备及其状态。
adb devices [-l]adb devices -l通过 TCP/IP 方式连接到指定设备(需先开启网络调试)。
adb connect <host>[:port]adb connect 192.168.1.20:5555断开指定的 TCP/IP 设备连接,省略地址则断开全部。
adb disconnect [host[:port]]adb disconnect 192.168.1.20:5555Android 11+ 无线调试配对,用于首次建立可信连接。
adb pair <host>:<port>adb pair 192.168.1.20:37123将设备的 adb 切换为 TCP/IP 监听模式,便于后续无线连接。
adb tcpip <port>adb tcpip 5555将 adb 切换回 USB 监听模式,关闭网络调试。
adb usbadb usb强制结束本地 adb server 进程,常用于连接异常时重置。
adb kill-serveradb kill-server启动本地 adb server 进程,多数命令会自动触发。
adb start-serveradb start-server在多设备场景下通过序列号指定目标设备执行命令。
adb -s <serial> <command>adb -s emulator-5554 shell pm list packages阻塞当前命令,直到至少有一台设备连接到 adb。
adb wait-for-device [next-command]adb wait-for-device shell getprop ro.product.model查看本机 adb 客户端的版本号与协议版本。
adb versionadb version获取设备当前状态,如 device、bootloader、offline。
adb get-stateadb get-state查询当前设备的序列号。
adb get-serialnoadb get-serialno读取 Android 系统属性,可获取型号、版本、SDK 等信息。
adb shell getprop [name]adb shell getprop ro.build.version.release查看电池电量、温度、是否充电等详细状态。
adb shell dumpsys batteryadb shell dumpsys battery查看进程内存占用,可定位内存泄漏。
adb shell dumpsys meminfo [package|pid]adb shell dumpsys meminfo com.android.chrome查看或修改设备屏幕分辨率。
adb shell wm size [WxH|reset]adb shell wm size 1080x1920查看或修改屏幕像素密度(dpi)。
adb shell wm density [dpi|reset]adb shell wm density 320向设备安装 APK,支持升级、降级、保留数据等选项。
adb install [-r|-t|-d|-g] <apk>adb install -r app-release.apk一次安装多个 APK,常用于 Split APK / AAB。
adb install-multiple [选项] <apk...>adb install-multiple base.apk config.armeabi_v7a.apk卸载指定包名的应用。
adb uninstall [-k] <package>adb uninstall com.example.app列出设备上的所有应用包名。
adb shell pm list packages [-3|-s|-f]adb shell pm list packages -3获取指定包名应用的 APK 安装路径。
adb shell pm path <package>adb shell pm path com.android.chrome清除应用的全部数据与缓存,相当于卸载重装。
adb shell pm clear <package>adb shell pm clear com.example.app为当前用户禁用指定应用,常用于停用系统应用。
adb shell pm disable-user [--user <id>] <package>adb shell pm disable-user --user 0 com.example.bloat通过 Activity Manager 启动一个 Activity。
adb shell am start [-n component|-a action]adb shell am start -n com.android.settings/.Settings强制停止指定包名的应用进程。
adb shell am force-stop <package>adb shell am force-stop com.example.app发送一个广播 Intent,常用于触发组件逻辑或测试。
adb shell am broadcast -a <action> [extras]adb shell am broadcast -a android.intent.action.BOOT_COMPLETED向应用发送伪随机事件,做压力或稳定性测试。
adb shell monkey [选项] -p <package> <count>adb shell monkey -p com.example.app -v 500把本地文件或目录上传到设备指定路径。
adb push <local> <remote>adb push ./config.json /sdcard/Download/把设备上的文件或目录拉取到本地。
adb pull <remote> [local]adb pull /sdcard/DCIM/Camera ./photos增量同步本机构建产物到设备相应目录(system/vendor/data)。
adb sync [分区]adb sync data列出设备目录下的文件与子目录。
adb shell ls [-l|-a] <path>adb shell ls -l /sdcard/删除设备上的文件或目录,请谨慎使用。
adb shell rm [-r|-f] <path>adb shell rm -rf /sdcard/Download/tmp复制设备内部的文件或目录。
adb shell cp [-r] <src> <dst>adb shell cp /sdcard/a.txt /sdcard/b.txt移动或重命名设备上的文件、目录。
adb shell mv <src> <dst>adb shell mv /sdcard/a.log /sdcard/old/a.log在设备上创建目录,可递归创建多层。
adb shell mkdir [-p] <dir>adb shell mkdir -p /sdcard/MyApp/cache查看设备的系统及应用日志,是排查问题的核心工具。
adb logcat [选项] [filterspec]adb logcat *:E清空设备上的所有 logcat 日志缓冲区。
adb logcat -cadb logcat -c导出当前已缓存的日志后立即退出。
adb logcat -dadb logcat -d > device.log指定日志输出格式,如 time、threadtime、long。
adb logcat -v <format>adb logcat -v threadtime生成完整的 bug report 压缩包,包含日志、dumpsys、堆栈等。
adb bugreport [path]adb bugreport ./bugreport.zip查看内核环形缓冲区的日志信息。
adb shell dmesgadb shell dmesg | tail -n 100进入设备的交互式 shell,或一次性执行指定命令。
adb shell [command]adb shell向当前输入框模拟键入文本。
adb shell input text <text>adb shell input text hello模拟按键事件,如返回、Home、音量等。
adb shell input keyevent <code>adb shell input keyevent 4在屏幕指定坐标模拟一次点击。
adb shell input tap <x> <y>adb shell input tap 500 1200模拟滑动手势,可控制时长实现长按。
adb shell input swipe <x1> <y1> <x2> <y2> [ms]adb shell input swipe 300 1000 300 200 200读取或写入系统设置(global/system/secure)。
adb shell settings [get|put] <ns> <key> [value]adb shell settings put global airplane_mode_on 1截取设备屏幕并保存为 PNG 图片。
adb shell screencap -p <path>adb shell screencap -p /sdcard/screen.png录制屏幕视频(Android 4.4+),保存为 MP4。
adb shell screenrecord [选项] <path>adb shell screenrecord --time-limit 30 /sdcard/demo.mp4无中转文件直接将截图传到本地。
adb exec-out screencap -p > <local.png>adb exec-out screencap -p > screen.png重启设备,可指定进入特殊模式。
adb reboot [bootloader|recovery|sideload]adb reboot recovery在支持的 ROM 上让 adbd 以 root 身份运行。
adb rootadb root退出 root 模式,让 adbd 回到普通用户权限。
adb unrootadb unroot将系统分区重新挂载为可读写,常配合修改系统文件。
adb remountadb remount关闭系统分区的校验,使 remount 写入生效。
adb disable-verityadb disable-verity重新开启系统分区的 dm-verity 校验。
adb enable-verityadb enable-verity通过 recovery 模式向设备刷入 OTA 或完整 zip 包。
adb sideload <package.zip>adb sideload update.zip备份设备数据为 .ab 文件(Android 6 后系统逐步弱化)。
adb backup [选项] [-f file]adb backup -all -f backup.ab将之前 adb backup 生成的 .ab 文件恢复回设备。
adb restore <file>adb restore backup.ab将本机端口转发到设备端口,常用于调试本地与设备通讯。
adb forward <local> <remote>adb forward tcp:8080 tcp:8080列出当前 adb forward 已建立的全部端口映射。
adb forward --listadb forward --list移除指定的本机端口转发规则。
adb forward --remove <local>adb forward --remove tcp:8080将设备端口反向转发到本机端口,让 App 访问本地服务。
adb reverse <remote> <local>adb reverse tcp:3000 tcp:3000查看当前设备反向端口转发列表。
adb reverse --listadb reverse --list移除指定的设备到本机的反向端口转发。
adb reverse --remove <remote>adb reverse --remove tcp:3000查看设备各网络接口的 IP、MAC、状态。
adb shell ip addradb shell ip addr show wlan0在设备端发起 ICMP 测试,判断网络连通性。
adb shell ping <host>adb shell ping -c 4 8.8.8.8列出可被 JDWP 调试器附加的 Java 进程 PID。
adb jdwpadb jdwp实时查看设备进程的 CPU、内存占用。
adb shell top [-n <times>]adb shell top -n 1快照当前设备运行中的进程列表。
adb shell ps [-A|-T]adb shell ps -A | grep com.example导出指定系统服务或全部服务的运行状态。
adb shell dumpsys [service]adb shell dumpsys activity activities设置系统属性,调试日志、调度等行为。
adb shell setprop <name> <value>adb shell setprop log.tag.MyTag VERBOSE对指定进程开启或停止 method tracing 性能采样。
adb shell am profile start|stop <process> [file]adb shell am profile start com.example /sdcard/trace.traceAndroid 7+ 提供的 activity 调试命令集,可控制睡眠、模式等。
adb shell cmd activity <subcmd>adb shell cmd activity start -n com.example/.MainActivityWhen debugging Android applications, developers often find themselves repeatedly consulting documentation because they can't remember complex ADB commands. This ADB Command Cheat Sheet brings together frequently used commands for device connection, app installation, log capture, and file transfer. Presented with clear categories and examples, it helps you quickly locate the exact command you need without having to memorize them.
adb shell screencap -p /sdcard/screenshot.png and explain that this command saves a screenshot of the current display to a specified path on the device.adb devices in your command line. If it returns your device's serial number and the status "device", the connection is successful.Please ensure that "USB debugging" is enabled on your Android device and that you have authorized your current computer. Some commands (such as deleting system files) may fail to execute due to device manufacturer restrictions, so proceed with caution. This tool provides command references only; please verify the accuracy of the commands before executing them to prevent data loss.
In automated testing or batch device management scenarios, you can use adb shell to enter the device terminal for continuous operations. For log analysis, we recommend using adb logcat -v time to add timestamps, making it easier to pinpoint issues. Typical examples include overwriting an existing app installation with adb install -r app.apk, or capturing the screen with adb shell screencap /sdcard/display.png.

JSON Formatter
Process JSON data online: format, minify, and validate to boost your development and debugging efficiency.

PYC Decompiler
Restore Python bytecode .pyc files into readable source code for easy code auditing and learning. Supports mainstream versions.

URL to JSON Parser
Parse URL strings into structured JSON to quickly extract key information like protocols, parameters, and paths.

Code Compare
Professionally compare differences between two texts or code snippets. Highlights additions, deletions, and modifications to assist with code review, document merging, and version control.

JSON Formatter
Process JSON data online: format, minify, and validate to boost your development and debugging efficiency.

PYC Decompiler
Restore Python bytecode .pyc files into readable source code for easy code auditing and learning. Supports mainstream versions.

URL to JSON Parser
Parse URL strings into structured JSON to quickly extract key information like protocols, parameters, and paths.

Code Compare
Professionally compare differences between two texts or code snippets. Highlights additions, deletions, and modifications to assist with code review, document merging, and version control.

JSON to TypeScript Converter
Automatically convert JSON data into TypeScript interfaces or type aliases for frontend data modeling and API integration.