cmd>
adb
Android Debug Bridge version 1.0.32
-a - 直接通过adb监听全部连接的接口。
directs adb to listen on all interfaces for a connection
-d - 直接向唯一连接的USB设备发送指令,如果有多个设备则返回错误。
directs command to the only connected USB device returns an error if more than one USB device is present.
-e - 直接向唯一运行的模拟器发送指令,如果有多个模拟器运行则返回错误。
directs command to the only running emulator. returns an error if more than one emulator is running.
-s <specific device> - 直接通过给定的序列号或限定词向设备或模拟器发送指令。此时覆盖ANDROID_SERIAL中环境变量值。
directs command to the device or emulator withthe given serial number or qualifier. Overrides ANDROID_SERIAL environment variable.
-p <product name or path> - 设置项目名称,或项目路径。如果未指定此参数,则使用android_product_out环境变量的值,它必须是绝对路径。
simple product name like 'sooner', or a relative/absolute path to a product out directory like 'out/target/product/sooner'. If -p is not specified, the ANDROID_PRODUCT_OUT environment variable is used, which must be an absolute path.
-H - 指定adb服务所在主机名。
Name of adb server host (default: localhost)
-P - 指定adb服务的端口。
Port of adb server (default: 5037)
devices [-l] - 列表显示全部连接的设备。
list all connected devices ('-l' will also list device qualifiers)
connect <host>[:<port>] - 连接到一个设备,如果没有指定端口号,则默认使用5555端口。
connect to a device via TCP/IP Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]] - 断开连接设备,没有指定则默认断开使用5555端口连接的设备。使用此命令不带附加参数将断开所有连接的TCP/IP设备。
disconnect from a TCP/IP device. Port 5555 is used by default if no port number is specified. Using this command with no additional arguments will disconnect from all connected TCP/IP devices.
=================================================================================== www.cuiweiyou.com ============
device commands 设备指令:
adb push [-p] <local> <remote>
- 从本地推送文件/目录到设备。-p参数显示进度条。
copy file/dir to device ('-p' to display the transfer progress)
adb pull [-p] [-a] <remote> [<local>]
- 从设备上下载文件/目录到本地。-p显示进度条,-a指拷贝文件时间戳和属性。
copy file/dir from device ('-p' to display the transfer progress) ('-a' means copy timestamp and mode)
adb sync [-l] [ <directory> ] - 只从主机复制发生改变的内容到设备。-l只列表显示发生改变的内容,但不进行复制。
copy host->device only if changed (-l means list but don't copy) (see 'adb help all')
adb shell - 进行shell交互。
run remote shell interactively
adb shell <command> - 运行shell命令。
run remote shell command
adb emu <command> - 运行模拟器命令行指令。
run emulator console command
adb logcat [ <filter-spec> ] - 查看设备日志。
View device log
adb forward --list - 列表显示全部的socket连接。显示格式:串口 本地地址 远程地址
list all forward socket connections. the format is a list of lines with the following format: <serial> " " <local> " " <remote> "\n"
adb forward <local> <remote> - 从本地端口重定向连接到模拟器或手机的指定端口。
forward socket connections. forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb forward --no-rebind <local> <remote>
- 像上面的'adb forward <local> <remote>'指令,但是如果local地址已经重定向则失败
same as 'adb forward <local> <remote>' but fails if <local> is already forwarded
adb forward --remove <local> - 移除一个指定的socket重定向连接
remove a specific forward socket connection
adb forward --remove-all - 移除全部的socket重定向连接
remove all forward socket connections
adb reverse --list - 列表显示设备上全部的反向连接。
list all reverse socket connections from device
adb reverse <remote> <local> - reverse socket connections
reverse specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
adb reverse --norebind <remote> <local>
- same as 'adb reverse <remote> <local>' but fails if <remote> is already reversed.
adb reverse --remove <remote>
- remove a specific reversed socket connection
adb reverse --remove-all - remove all reversed socket connections from device
adb jdwp - 列表查看设备的JDWP进程
list PIDs of processes hosting a JDWP(Java Debug Wire Protocol-JAVA调试器无线协议) transport
adb install [-lrtsd] <file> - 用完整路径指定.apk文件安装应用程序。-l指远期锁定APP,-r指覆盖安装APP并保留旧数据,-t指先测试安装一下,-s指安装进SD卡中,-d指允许降级版本
adb install-multiple [-lrtsdp] <file...>
- 将一个目录内的全部apk程序安装到设备。
push this package file to the device and install it
(-l: forward lock application)
(-r: replace existing application)
(-t: allow test packages)
(-s: install application on sdcard)
(-d: allow version code downgrade)
(-p: partial application install)
adb uninstall [-k] <package> - 从设备卸载app。-k保留app的数据。
remove this app package from the device ('-k' means keep the data and cache directories)
adb bugreport - 返回包括调试报告在内的全部设备信息。
return all information from the device that should be included in a bug report.
adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
- 备份设备数据。如果没有指定-f参数,则在当前目录创建backup.ab文件。
write an archive of the device's data to <file>. If no -f option is supplied then the data is written to "backup.ab" in the current directory.
(-apk|-noapk 确定或否定把app的.apks文件包括到备份文件中,默认不包括。enable/disable backup of the .apks themselves in the archive; the default is noapk.)
(-obb|-noobb 确定或否定把每个app对应的aka、.obb扩展文件包括到备份文件中,默认不包括。enable/disable backup of any installed apk expansion (aka .obb) files associated with each application; the default is noobb.)
(-shared|-noshared 确定或否定把设备上共享目录、sd卡内容包括到备份文件中,默认不包括。enable/disable backup of the device's shared storage / SD card contents; the default is noshared.)
(-all 备份全部安装的应用。means to back up all installed applications)
(-system|-nosystem 是否备份全部的系统应用,默认包括。toggles whether -all automatically includes system applications; the default is to include system apps)
(<packages...> 指定要备份的应用集合。is the list of applications to be backed up. If the -all or -shared flags are passed, then the package list is optional. Applications explicitly given on the command line will be included even if -nosystem would ordinarily cause them to be omitted.)
adb restore <file> - 通过备份还原设备内容。
restore device contents from the <file> backup archive
adb disable-verity - 在USERDEBUG-用户调试构建时禁用dm-verity(linux的device mapper)检测。
disable dm-verity checking on USERDEBUG builds
adb keygen <file> - 生成公有key或似有key。私有key直接保持在指定文件,公有key保存为指定文件加后缀名.pub。覆盖已有文件。
generate adb public/private key. The private key is stored in <file>, and the public key is stored in <file>.pub. Any existing files are overwritten.
adb help - show this help message
adb version - show version num
======================================================================================= www.cuiweiyou.com ========
scripting 脚本:
adb wait-for-device - 等待设备上线。block until device is online
adb start-server - 启动服务。ensure that there is a server running
adb kill-server - 杀死服务。kill the server if it is running
adb get-state - 查询设备状态。prints: offline | bootloader | device
adb get-serialno - 查询设备串号。prints: <serial-number>
adb get-devpath - 查询设备路径。prints: <device-path>
adb status-window - 持续打印一个设备的状态信息。continuously print device status for a specified device
adb remount - 重新挂载系统分区,使系统分区重新可写。remounts the /system and /vendor (if present) partitions on the device read-write
adb reboot [bootloader|recovery] - 重启设备,指定启动时进入引导还是恢复。reboots the device, optionally into the bootloader or recovery program
adb reboot-bootloader - 重启设备进入引导而启动系统。单纯的重启。reboots the device into the bootloader
adb root - 重启使adbd daemon具有root权限。restarts the adbd daemon with root permissions
adb usb - 重启使adbd daemon监听USB。restarts the adbd daemon listening on USB
adb tcpip <port> - 重启使adbd daemon监听指定端口。restarts the adbd daemon listening on TCP on the specified port
======================================================================================= www.cuiweiyou.com ========
networking 网络:
adb ppp <tty> [parameters] - 通过USB运行ppp拨号模块。Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
======================================================================================= www.cuiweiyou.com ========
adb sync notes 同步:
adb sync [ <directory> ] - 把设备里面/system和/data和电脑上的同步,把改变以后的文件替换成电脑上的
<localdir> can be interpreted in several ways:
- If <directory> is not specified, /system, /vendor (if present), and /data partitions will be updated.
- If it is "system", "vendor" or "data", only the corresponding partition is updated.
======================================================================================= www.cuiweiyou.com ========
environmental variables 环境变量:
ADB_TRACE - 打印调试信息的内容,多个用逗号隔开。Print debug information. A comma separated list of the following values 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL - 指定连接的串口。-s为已给定的值。The serial number to connect to. -s takes priority over this if given.
ANDROID_LOG_TAGS - 当使用logcat选项,只打印这里设置的标签。When used with the logcat option, only these debug tags are printed.
cmd>
本文由崔维友 威格灵 cuiweiyou vigiles cuiweiyou 原创,转载请注明出处:http://www.gaohaiyan.com/1592.html
承接App定制、企业web站点、办公系统软件 设计开发,外包项目,毕设