本章提供了一些有价值的Android SDK工具参考项目,这些工具你已经在本书的课程中使用过了。它们给了你一些命令行选项,可以在Android模拟器和Android调试桥中使用。
Android模拟器命令
下表包含了大多数常规的Android模拟器命令。这些命令在2008年3月份发布的SDK版本中可用。每个命令提供了简短的描述。
Emulator Command 模拟器命令 | 功能 |
emulator -console | Enables the console shell on the current terminal 在当前终端上激活控制台外壳 |
emulator -data <filename> |
Uses a different file as the working user-data disk image 使用一个不同的文件作为工作用户数据磁盘镜像 |
emulator -debug-kernel | Sends kernel output to the console 发送核心输出到控制台 |
emulator -flash-keys | Flashes keypresses on the device skin 在设备皮肤上闪烁keypress |
emulator -help | Prints a list of all Emulator commands 列出模拟器列表 |
emulator -http-proxy <proxy> | Makes all TCP connections through a specified HTTP/HTTPS proxy 通过一个定义的HTTP/HTTPS 代理制作所有的TCP连接。 |
emulator -image <file> Uses <file> | as the system image 作为系统镜像 |
emulator -kernel <file> Uses <file> | as the emulated kernel 作为模拟的核心 |
emulator -logcat <logtags> | Enables logcat output with given tags 用指定的标签激活logcat输出 |
emulator -mic <device or file> | Uses device or WAV file for audio input 使用设备或者WAV文件作为音频输入 |
emulator -netdelay <delay> | 设置网络反应时间模拟到<delay>Sets network latency emulation to <delay>. (The <delay> parameter simulates the delay experienced on specific types of networks.<delay>参数模拟在定义类型的网络) The <delay>s you can use are as follows 可以使用的<delay>如下: ● Gprs ● Edge ● Umts ● None ● <num> ● <min>:<max> |
emulator -netfast Shortcut for -netspeed full -netdelay |
none |
emulator -netspeed <speed> | 设置网络速度模拟到<speed>。Sets network speed emulation to <speed>. (The <speed> parameter simulates the data speed experienced on specific types of networks.) The <speed>s you can use are as follows: ● Gsm ● Hscsd ● Gprs ● Edge ● Umts ● Hsdpa ● Full ● <num> ● <up>:<down> |
emulator -noaudio | Disables Android audio support废除Android音频支持 |
emulator -nojni | Disables JNI checks in the Dalvik virtual machine在Dalvik virtual machine中废除JNI检查 |
emulator -noskin | Specifies not to use any Emulator skin 定义为不使用任何模拟器皮肤 |
emulator -onion <image> | Uses overlay image over screen 在屏幕上使用覆盖图像 |
emulator -onion-alpha <percent> | Specifies onion skin translucency value (as percent) 定义半透明皮肤值(百分比) |
emulator -qemu | Passes arguments to QEMU 传递参数到QEMU |
emulator -qemu -h | Displays QEMU help 显示QEMU帮助 |
emulator -radio <device> | Redirects the radio modem interface to a host character device重定向无线调制解调器接口到一个主字符设备 |
emulator -ramdisk <file> Uses <file> |
as the ramdisk image作为ramdisk镜像 |
emulator -raw-keys | Disables Unicode keyboard reverse mapping禁用Unicode键盘转换映射 |
emulator -sdcard <file> Uses <file> |
as the SD Memory Card image作为SD内存卡镜像 |
emulator -skin <skinID> | 使用定义的皮肤启动模拟器Starts the Emulator with the specified skin: ● HVGA-L 480x320, landscape ● HVGA-P 320x480, portrait (default) ● QVGA-L 320x240, landscape ● QVGA-P 240x320, portrait |
emulator -skindir <dir> | Searches for Emulator skins in <dir> 在<dir>内查找模拟器皮肤 |
emulator -system <dir> |
Searches system, ramdisk, and user-data disk images in <dir> 在<dir>内查找系统,ramdisk和用户数据磁盘镜像 |
emulator -trace <name> |
Enables code profiling (press F9 to start), written to a specified file 启动代码分析(按F9启动),写入一个定义的文件 |
emulator -useaudio |
Enables Android audio support启动Android音频支持 |
emulator -verbose |
Enables verbose output激活冗长的输出 |
emulator -verbose-keys |
Enables verbose keypress messages激活冗长的的按键信息 |
emulator -verbose-proxy |
Enables verbose proxy debug messages激活冗长的的代理调试信息 |
emulator -wipe-data | Deletes all data on the user-data disk image在用户数据磁盘镜像中删除所有数据(开始前参见emulator - data<filename>) (see emulator –data <filename>) before starting |
Android调试桥命令
下面的是gsm命令。通过连接到Android模拟器的终端控制台使用。如果你不了解端口终端控制台,它是一个比调试端口少的端口。执行adb来获得活动的设备列表和相关的端口号。
adb Bugreport |
Prints dumpsys, dumpstate, and logcat data to the screen, for the purposes of bug reporting 为故障报告在屏幕上打印dumpsys,dumpstate和logcat数据 |
adb call <phonenumber> | Simulates an inbound phone call from <phonenumber>模拟一个呼入的电话 |
adb cancel <phonenumber> | Cancels an inbound phone call from <phonenumber>取消一个呼入的电话 |
adb -d {<ID>|<serialNumber>} | Lets
you direct an adb command to a specific Emulator/device instance,
referred to by its adb-assigned ID or serial number 允许你指引一个adb命令到一个定义的模拟器/设备示例中,通过它的赋值adb ID或者序列号来引用 |
adb data <state> | Changes the state of the GPRS data connection to <state>改变GPRS数据连接状态到<state> |
adb Devices | Prints a list of all attached mulator/device instances 打印所附模拟器列表/设备示例 |
adb forward <local> <remote> | Forwards socket connections from a specified local port to a specified remote port on the Emulator/device instance 在模拟器/设备示例中从一个定义的本来端口转递socket连接到一个定义的远程端口 |
adb get-serialno | Prints the adb instance identifier string 打印adb示例标识符字符串 |
adb get-state | Prints the adb state of an emulator/device instance 打印一个模拟器/设备示例的adb状态 |
adb help | Prints a list of supported adb commands 打印支持的adb命令列表 |
adb install <path-to-apk> | Pushes an Android application (specified as a full path to an .apk file) to the data file of an Emulator/device 推入Android应用程序(作为一个完整路径一个.apk文件)到模拟器/设备示例 |
adb jdwp | Prints a list of available JDWP processes on a given device 在指定的设备上列出可用的JDWP进程 |
adb kill-server | Terminates the adb server process 终止adb服务器进程 |
adb logcat [<option>] [<filter-specs>] |
Prints log data to the screen在屏幕上打印log数据 |
adb ppp <tty> [parm]... | Runs PPP over USB通过USB运行PPP: ● <tty> The tty for PPP stream; for example, dev:/dev/omap_csmi_ttyl <tty>ppp流;例如,dev:/dev/omap_csmi_ttyl ● [parm]... Zero or more PPP/PPPD options, such as defaultroute, local, notty, etc. 0或者更多的PPP/PPPD选项,如defaultroute, local,notty等等 Note that you should not automatically start a PDP connection. 注意,你不应当自动启动一个PDP连接 |
adb pull <remote> <local> | Copies a specified file from an Emulator/device instance to your development computer 从模拟器/设备复制定义的文件到你的电脑 |
adb push <local> <remote> |
Copies a specified file from your development computer to an Emulator/device instance 从电脑中复制文件到模拟器/设备 |
adb Shell | Starts a remote shell in the target Emulator/device instance 在目标模拟器/设备上启动远程外壳 |
adb start-server | Checks whether the adb server process is running and, if not, starts it 检测adb服务器进程是否启动,如果否,启动它 |
adb Status | Reports the current GSM voice/data state 报告当前GSM声音/数据状态 |
adb unregistered | Indicates no network is available 指示无网络可用 |
adb Version | Prints the adb version number 打印adb版本号 |
adb voice <state> | Changes the state of the GPRS voice connection to <state>改变GPRS声音状态连接到<state> |
adb wait-for-bootloader | Blocks execution until the bootloader is online—that is, until the instance state is bootloader 阻止执行直到引导装入完成。也就是除非设备完成引导 |
adb wait-for-device | Blocks execution until the device is online—that is, until the instance state is device 阻止执行直到设备在线。也就是示例状态是设备 |
注意:为不产生歧义,本表格的解释部分仍保留英文。
至此,历经两个多月的时间,本书的翻译工作全部完成,在英文版的书中还有索引部分,这里就没有必要翻译了。