# Android_ADB **Repository Path**: sipu/Android_ADB ## Basic Information - **Project Name**: Android_ADB - **Description**: Android调试工具Adb的一个副本,附带一个中文使用舒适注释文档. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-07-12 - **Last Updated**: 2023-10-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ADB ## 介绍 adb是连接Android设备并进行调试的一个Android平台工具。可以进行安卓设备的各种操作。 [一个详解博客](https://www.cnblogs.com/wx2017/p/10883189.html) ## 目录 文件|文件作用 |:-|:-| adb.exe|Android调试连接器 AdbWinApi.dll|连接器在Windows平台下的动态库 AdbWinUsbApi.dll|连接器在Windows下的USB动态库 ## ADB用法 提示信息,包括adb的版本和安装位置: 版本: Android Debug Bridge version 1.0.41 Version 30.0.2-6538114 安装位置: Installed as C:\Users\m1584\Documents\auto_control\toolchains\adb\adb.exe 全局选项|作用 |:-|:-| global options:| -a|listen on all network interfaces, not just localhost ||监听所有网络端口,不仅仅只是本地端口 -d|use USB device (error if multiple devices connected) ||使用USB进行连接(当有多个设备连接时出错) -e|use TCP/IP device (error if multiple TCP/IP devices available) ||使用TCP/IP设备(当有多个连接设备时出错) -s SERIAL|use device with given serial (overrides $ANDROID_SERIAL) ||根据给定的设备串号使用设备(会覆盖$ANDROID_SERIAL变量) -t ID|use device with given transport id ||根据指定的ID使用指定的设备 -H|name of adb server host [default=localhost] ||adb服务器的名称[默认=localhost] -P|port of adb server [default=5037] ||服务器的端口号[default=5037] -L SOCKET|listen on given socket for adb server [default=tcp:localhost:5037] ||根据指定的socket连接监听adb服务器 |一般选项|作用 |:-|:-| general commands:| devices [-l]|list connected devices (-l for long output) ||显示连接的设备(-l选项输出详细输出) help|show this help message ||显示该帮助信息 version|show version num ||显示版本号 |网络选项|作用 |:-|:-| networking:| connect HOST[:PORT]|connect to a device via TCP/IP [default port=5555] ||通过TCP/IP连接指定的设备[默认端口=5555] disconnect [HOST[:PORT]]|disconnect from given TCP/IP device [default port=5555], or all pair HOST[:PORT] [PAIRING CODE]pair with a device for secure TCP/IP communication ||断开指定的TCP/IP设备的连接,给定[HOST[:PORT]] , 或者断开与所有主机的连接,通过一个安全的TCP/IP连接 forward --list|list all forward socket connections ||列出所有的socket连接 forward [--no-rebind] LOCAL REMOTE|转发socket接口的数据 ||forward socket connection using: ||正向连接套接字的使用 ||tcp:\ ( may be "tcp:0" to pick any open port) ||tcp:<端口>(使用"tcp:0"来连接任意接口) ||localabstract:\ ||本地摘要模式:unix的守护socket名称 ||localreserved:\ ||本地接受|unix的守护socket名称 ||localfilesystem:\ ||本地的文件系统|unix的守护socket名称 ||dev:\ ||设备:设备名称 ||jdwp:\ (remote only) ||jdwP:监控的进程 ||acceptfd:\ (listen only) ||接受的id forward --remove LOCAL |remove specific forward socket connection ||移除一个指定的socket连接 forward --remove-all |remove all forward socket connections ppp TTY [PARAMETER...] |run PPP over USB ||在USB上运行PPP reverse --list |list all reverse socket connections from device ||列出设备上所有的反向套接字连接 reverse [--no-rebind] REMOTE LOCAL|反向socket连接 ||reverse socket connection using: ||对于反向socket连接的使用 ||tcp:\ ( may be "tcp:0" to pick any open port) ||tcp:<端口>(<远程>如果使用"tcp:0"则可能打开任何端口) ||localabstract:\ ||本地摘要:unix的守护socket名称 ||localreserved:\ ||本地反向|unix的守护socket进程 ||localfilesystem:\ ||本地文件系统:unix的守护socket进程 reverse --remove REMOTE| remove specific reverse socket connection ||移除一个远程的反向代理 reverse --remove-all |remove all reverse socket connections from device ||移除设备上所有的反向socket代理 mdns check|check if mdns discovery is available ||检查mdns发现是否可用 mdns services|list all discovered services ||列出所有发现的服务 |文件传输|作用| |:----|:--------| file transfer:| push|[--sync] [-z ALGORITHM] [-Z] LOCAL... REMOTE copy local files/directories to device ||通用的语法格式,复制本地的文件或者文件夹到设备上 |--sync| only push files that are newer on the host than the device ||只复制本地比远程设备上更新的文件,相当于同步文件 |-n| dry run: push files to device without storing to the filesystem ||将文件推送到设备而不储存在文件系统 |-z|enable compression with a specified algorithm (any, none, brotli) ||使用指定的算法进行压缩 |-Z| disable compression ||禁止进行压缩 pull |[-a] [-z ALGORITHM] [-Z] REMOTE... LOCAL copy files/dirs from device ||从指定的设备拉取文件或者文件夹到本地 |-a| preserve file timestamp and mode ||保留文件的时间戳和模式 |-z| enable compression with a specified algorithm (any, none, brotli) ||使指定的算法进行压缩 |-Z| disable compression ||禁止使用压缩 sync |[-l] [-z ALGORITHM] [-Z] [all \| data \| odm \| oem \| product \| system \| system_ext \| vendor] sync a local build from $ANDROID_PRODUCT_OUT to the device (default all) ||从本地构建($ANDROID_PRODUCT_OUT)同步目标文件到指定的设备 |-n| dry run: push files to device without storing to the filesystem ||仅仅只复制文件,而不再文件系统中储存 |-l| list files that would be copied, but don't copy them ||列出要被复制的文件,但是不进行复制操作 |-z| enable compression with a specified algorithm (any, none, brotli) ||使用指定的算法进行数据压缩 |-Z| disable compression ||禁止进行文件压缩 |sehll|命令 |:-|:-|:-| shell:| |shell [-e ESCAPE] [-n] [-Tt] [-x] [COMMAND...]| run remote shell command (interactive shell if no command given) ||运行远程shell命令(如果没有指定命令时运行交互式shell) |-e| choose escape character, or "none"; default '~' ||选择转义字符,默认是"~" |-n| don't read from stdin ||不要从标准输入读取 |-T| disable pty allocation ||禁用pty分配 |-t| allocate a pty if on a tty (-tt: force pty allocation) ||在使用tty时使用pty分配(-tt 强制使用pty分配) |-x| disable remote exit codes and stdout/stderr separation ||禁止使用远程退出代码并且禁止标准输出的标准错误输出分离,分离的意思是分离AndroidShell和调用的shell输出流 |emu COMMAND |run emulator console command ||其他命令,运行其他命令 |应用软件包|作用 |:-|:-| app installation (see also `adb shell cmd package help`):|app安装器(详情使用 `adb shell cmd package help` 查看) install [-lrtsdg] [--instant] PACKAGE |push a single package to the device and install it ||像设备推送单个app安装包并安装它 install-multiple [-lrtsdpg] [--instant] PACKAGE...|push multiple APKs to the device for a single package and install them ||通过一个单一的安装包向一个设备推送多个安装包并安装 install-multi-package [-lrtsdpg] [--instant] PACKAGE...|push one or more packages to the device and install them atomically ||推送多个包并自动安装他们 |-r| replace existing application ||替换已有的安装包 |-t| allow test packages ||允许测试安装包 |-d| allow version code downgrade (debuggable packages only) ||允许降级安装(*仅限测试安装包*) |-p|partial application install (install-multiple only) ||安装部分(*仅对多个安装app有用*) |-g|grant all runtime permissions ||授予所有运行时权限 |--abi ABI| override platform's default ABI ||覆盖平台的默认ABI |--instant| cause the app to be installed as an ephemeral install app ||是程序作为临时安装包安装 |--no-streaming| always push APK to device and invoke Package Manager as separate steps ||总是使用单独的安装包管理器管理安装的程序 |--streaming|force streaming APK directly into Package Manager ||强制将流式APK直接导入包管理器 |--fastdeploy| use fast deploy ||使用快速部署 |--no-fastdeploy| prevent use of fast deploy ||禁止使用快速部署 |--force-agent|force update of deployment agent when using fast deploy ||使用快速部署时强制更新部署代理 |--date-check-agent|update deployment agent when local version is newer and using fast deploy ||本地版本较新且使用快速部署时更新部署代理 |--version-check-agent| update deployment agent when local version has different version code and using fast deploy ||当本地版本具有不同版本代码并使用快速部署时更新部署代理 (See also `adb shell pm help` for more options.)| uninstall [-k] PACKAGE|remove this app package from the device ||从设备上移除该安装包 |-k| keep the data and cache directories ||保留数据和缓存目录 |调试选项|作用 |:-|:-| debugging:|| bugreport [PATH]|write bugreport to given PATH [default=bugreport.zip];if PATH is a directory, the bug report is saved in that directory.devices that don't support zipped bug reports output to stdout. ||将bug报告写入指定的路径[PATH]如果指定的路径是一个文件夹,那么bug报告会被储存在这个文件夹中.设备不支持压缩bug报告到标准输出。 jdwp |list pids of processes hosting a JDWP transport ||列出拥有JDWP转换的线程pid logcat|show device log (logcat --help for more) ||显示设备日志(使用 `logcat --help` 来获得更多的帮助)

|安全选项|作用 |:-|:-| security:| disable-verity |disable dm-verity checking on userdebug builds ||在更新构建时禁止使用dm-varity检查 enable-verity|re-enable dm-verity checking on userdebug builds ||重新启用在构建时使用dm-verity检查 keygen FILE|generate adb public/private key; private key stored in FILE, ||生成adb共/私匙 , 私匙保存在文件中。 |脚本选项|作用| |:-|:-| scripting:| wait-for[-TRANSPORT]-STATE...|wait for device to be in a given state ||等待设备达到某种状态 ||STATE: device, recovery, rescue, sideload, bootloader, or disconnect ||状态 : 设备 , 恢复, 安全模式 ,边加载 ,boot loader , 或者失去连接 ||TRANSPORT: usb, local, or any [default=any] ||传输端口 : USB , 本地 , 或者任何其他[default=任何其他] get-state|print offline \| bootloader \| device ||获得状态 打印 离线,bootloader,device get-serialno |print \ ||获得串行代码 get-devpath |print \ ||打印设备路径 remount [-R]|remount partitions read-write. if a reboot is required, -R will will automatically reboot the device. ||重新挂载读写分区,如果需要重启, -R参数自动重启设备。 reboot |[bootloader\|recovery\|sideload\|sideload-auto-reboot] ||reboot the device; defaults to booting system image but supports bootloader and recovery too. sideload reboots into recovery and automatically starts sideload mode, sideload-auto-reboot is the same but reboots after sideloading. ||重新启动设备;默认为引导系统映像,但也支持引导加载程序和恢复。sideload重新启动到恢复并自动启动sideload模式,sideload自动重新启动与sideload相同,但在sideload之后重新启动。 sideload OTAPACKAGE|sideload the given full OTA package ||附带加载给定的完整OTA包 root|restart adbd with root permissions ||重新启动adbd并使用root权限 unroot|restart adbd without root permissions ||重新启动并去除root权限 usb|restart adbd listening on USB ||重新启动sdbd并监听USB tcpip PORT|restart adbd listening on TCP on PORT ||重新启动adbd并监听TCP端口 |内部调试|作用 |:-|:-| internal debugging:| start-server |ensure that there is a server running ||确定服务器在运行 kill-server |kill the server if it is running ||如果服务器在运行则停止运行 reconnect |kick connection from host side to force reconnect ||强行重新连接 reconnect device |kick connection from device side to force reconnect ||从设备侧强行重新连接 reconnect offline |reset offline/unauthorized devices to force reconnect ||重置脱机/未授权设备以强制重新连接 |环境变量|作用 |:-|:-| environment variables:| $ADB_TRACE|comma-separated list of debug info to log:all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp ||列出debug信息的分隔符,all , adb , sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp $ADB_VENDOR_KEYS |colon-separated list of keys (files or directories) ||以冒号分隔的键列表(文件或目录) $ANDROID_SERIAL |serial number to connect to (see -s) ||要连接的设备串号 $ANDROID_LOG_TAGS |tags to be used by logcat (see logcat --help) ||logcat使用的标签(详情参见: `logcat --help`) $ADB_LOCAL_TRANSPORT_MAX_PORT |max emulator scan port (default 5585, 16 emus) ||最大的模拟器扫描端口(默认 5585 , 16个) $ADB_MDNS_AUTO_CONNECT |comma-separated list of mdns services to allow auto-connect (default adb-tls-connect) ||允许自动连接的MDN服务的逗号分隔列表(默认adb-tls-connect)