android adb的使用(二)

adb的相关命令集:
Android Debug Bridge version 1.0.26 - #当升级 Android SDK 后,ADB 也会随之升级。
adb [-d|-e|-s {<serialNumber>}] shell
-d - EN directs command to the only connected USB device returns an error if more than one USB device is present.
- CHS 该操作只针对已经通过 USB 链接的移动设备,如果链接一台以上的移动设备会返回一个错误。

-e - EN directs command to the only running emulator. returns an error if more than one emulator is running.
- CHS 该操作只针对模拟器,如果同时运行的模拟器数量大于一,会返回一个错误。

-s <serial number> - EN directs command to the USB device or emulator with the given serial number. Overrides ANDROID_SERIAL environment variable.
- CHS 该操作针对 USB 链接的设备 或 给定编号的模拟器,复写 serial number 为要操作的模拟器编号。

-p <product name or path> - EN 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.
- CHS 该操作针对 设备的名称 或 设备相对/绝对的路径, 如果未把设备的加入环境变量,必须给定一个绝对路径。

devices - EN list all connected devices
- CHS 列出所有已经链接或启动的设备清单

connect <host>[:<port>] - EN connect to a device via TCP/IP Port 5555 is used by default if no port number is specified.
- CHS 如果 connect 后面未赋值, 通过 TCP/IP 5555 端口链接设备。

disconnect [<host>[:<port>]] - EN disconnect from a TCP/IP device. Port 5555 is used by default if no port number is specified. Using this ocmmand with no additional arguments will disconnect from all connected TCP/IP devices.
- CHS 如果 disconnect 后面未赋值,断开 TCP/IP 5555 端口上的设备,也可以使用 ocmmand 参数断开所有已经链接的设备。


device commands: #针对设备的命令

adb push <local> <remote> - EN copy file/dir to device
- CHS 复制 文件/目录 到设备

adb pull <remote> [<local>] - EN copy file/dir from device
- CHS 从设备复制 文件/目录

adb sync [ <directory> ] - EN copy host->device only if changed (-l means list but don't copy) (see 'adb help all')
- CHS 同步目录 该操作只针对 主机->设备 上的同步, 如果后面加 -l 意思为只罗列不复制。

adb shell - EN run remote shell interactively
- CHS 运行交互式 shell 脚本 (和 Linux, Unix 有区别,微型操作基本相同)

adb shell <command> - EN run remote shell command
- CHS 运行 shell 脚本 command 为参数

adb emu <command> - EN run emulator console command
- CHS 运行模拟器控制台命令

adb logcat [ <filter-spec> ] - EN View device log
- CHS 查看设备日志 (Eclipse logcat)

adb forward <local> <remote> - EN forward socket connections forward specs are one of:
- CHS 从本地的 socket 链接转移到特定的一个移动设备,参数如下:

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 jdwp - EN list PIDs of processes hosting a JDWP transport
- CHS 罗列 PIDs 进程寄宿 JDWP 传输

adb install [-l] [-r] [-s] <file> - EN push this package file to the device and install it
- CHS 给设备安装软件
('-l' means forward-lock the app) #锁定该程序
('-r' means reinstall the app, keeping its data) #重新安装该程序,保存数据
('-s' means install on SD card instead of internal storage) #安装在SD卡内,而不是设备内部存储

adb uninstall [-k] <package> - EN remove this app package from the device
- CHS 从设备删除程序包
('-k' means keep the data and cache directories) #不删除程序运行所产生的数据和缓存目录(如软件的数据库文件)

adb bugreport - EN return all information from the device that should be included in a bug report.
- CHS 返回所有的设备运行信息包括错误报告

adb help - EN show this help message
- CHS 显示帮助信息

adb version - EN show version num
- CHS 显示 adb 版本


DATAOPTS: #数据操作
(no option) - don't touch the data partition
- CHS 请勿随意操作数据分区

-w - EN wipe the data partition
- CHS 擦拭数据分区

-d - EN flash the data partition
- CHS 针对闪存


scripting: #脚本
adb wait-for-device - EN block until device is online
- CHS 等待设备链接

adb start-server - EN ensure that there is a server running
- CHS 确保在一个服务器上运行

adb kill-server - EN kill the server if it is running
- CHS 阻止设备与服务器之间的链接

adb get-state - EN prints: offline | bootloader | device
- CHS 打印设备当前的状态 |脱机关机|引导状态|运行状态

adb get-serialno - EN prints: <serial-number>
- CHS 打印序列号

adb status-window - EN continuously print device status for a specified device
- CHS 在该终端持续打印设备状态

adb remount - EN remounts the /system partition on the device read-write
- CHS 重新挂载系统分区获取设备的读写权限

adb reboot [bootloader|recovery] - EN reboots the device, optionally into the bootloader or recovery program
- CHS 重启启动设备,后面两个参数为引导程序和恢复程序

adb reboot-bootloader - EN reboots the device into the bootloader
- CHS 重启设备进入引导程序

adb root - EN restarts the adbd daemon with root permissions
- CHS 重新获取 adbd 宿主的管理员权限

adb usb - EN restarts the adbd daemon listening on USB
- CHS 在USB端口,重新获取 adbd 宿主

adb tcpip <port> - EN restarts the adbd daemon listening on TCP on the specified port 
- CHS 在制定 TCP/IP 端口,重新获取 adbd 宿主


networking: #网络
adb ppp
<tty> [parameters]- EN 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
- CHS 运行 PPP 在 USB 端口。 注意:你不能自动控制开始一个PPP链接。 <tty> 是指电报打印机所出的声音流。

EN adb sync notes: adb sync [ <directory> ] <localdir> can be interpreted in several ways:
- If <directory> is not specified, both /system and /data partitions will be updated.
- If it is "system" or "data", only the corresponding partition is updated.
- CHS adb 同步注意事项: adb sync [ <目录> ] <本地目录> 可以解释为几种方法:
- 如果 <目录> 未指定,那么 /system 和 /data 磁盘都会更新
- 指定 "system" 或 "data" 那么只有指定磁盘会更新 


environmental variables: #环境变量

ADB_TRACE- EN Print debug information. A comma separated list of the following values 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
- CHS 打印调试信息。使用都好隔开下面的一个或多个值,获取想要得到调试数据
adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp

ANDROID_SERIAL- EN The serial number to connect to. -s takes priority over this if given.

ANDROID_LOG_TAGS- EN When used with the logcat option, only these debug tags are printed.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章