Android Debug Bridge(adb)

Android Debug Bridge

In this document

1.    Enabling adbDebugging

2.    Syntax

3.    Commands

4.    Querying forEmulator/Device Instances

5.    DirectingCommands to a Specific Emulator/Device Instance

6.    Installing anApplication

7.    Forwarding Ports

8.    Copying Files toor from an Emulator/Device Instance

9.    Stopping the adbServer

10.  Wireless usage

Android Debug Bridge (adb) is a versatile【多功能的】 command line tool that lets you communicate with anemulator【模拟器,仿真器】 instance or connected Android-powered【android系统】 device【装置】. It is a client-server program【程序】 that includes three components【组件】:(2015-11-1 18:41:12)

·        A client, which runs on your development machine. You can invoke【调用】 a client from a shell by issuing an adb command. 【你可以通过在命令行输入adb命令调用一个client】Other Android tools such as the ADT plugin and DDMS also create adbclients.【其他的插件such asADT和DDMS是创建adb clients用的。】

·        A server, which runs as a background process【处理,程序】 on your development machine. The server manages communication between theclient and the adb daemon【守护进程,后台程序】 running on an emulator or device.

·        A daemon, which runs as a background process on each emulator or deviceinstance.

You can find the adb tool in <sdk>/platform-tools/.

When you start an adb client, the client first checks whether there is anadb server process already running. If there isn't, it starts the serverprocess. When the server starts, it binds【绑定,结合】 to local TCP port 5037 andlistens for commands sent from adb clients—all adb clients use port 5037 tocommunicate with the adb server.

The server then sets up connections to all running emulator/deviceinstances. It locates emulator/device instances by scanning odd-numbered【奇数】 ports in the range【范围】 5555 to 5585, the range used by emulators/devices. Where the server findsan adb daemon, it sets up a connection to that port. Note that eachemulator/device instance acquires【取得,获得】 a pair of sequential【连续的】 ports — an even-numbered【偶数】 port for console【控制台】 connections and an odd-numbered port for adb connections. For example:

Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557
and so on...

As shown, the emulator instance connected to adb on port 5555 is the sameas the instance whose console listens on port 5554.【如上所示,模拟器连接的端口5555和控制台监听的端口5554的内容是相同的。】

Once the server has set up connections to all emulator instances, you canuse adb commands to access those instances. Because the server managesconnections to emulator/device instances and handles commands from multiple adbclients, you can control any emulator/device instance from any client (or froma script).

 

AndroidDebug Bridge(adb)是一个多功能的命令行工具,它能使你控制一个模拟器或连接一个android系统装置。它是一个client-server程序,它包括三部分:

·client客户端:运行在你的开发机器上。你可以调用通过在命令行输入一个adb命令达到调用一个客户端的目的。其他的Android工具例如ADT插件和DDMS是用来创建adb客户端的。

·server服务器:运行在你的开发机器上的一个后台程序。服务器管理着客户端和运行在你的模拟器上的adb daemon【守护进程】的连接。

·daemon守护进程:作为一个后台程序运行在每一个模拟器上。

你可以在sdk的platform-tools文件夹下找到adb工具。

当你启动一个adb client的时候,这个client首先检查是否存在正在运行的serverprocess【进程】如果不存在,就启动一个。当server启动后,它绑定到localTCP prot 5037 并且监听来自adb client的命令——所有客户端使用port 5037去和server联系。

然后server而开始连接到所有的模拟器。Server在5555—5558范围内的奇数端口遍历emulator/divice【模拟器】。在这个范围中server找到一个adb demon【守护进程】它设置一个到端口的连接。注:每一个模拟器获得一组连续的端口其中console【控制台】占用的偶数端口和adb占用的奇数端口连接。例如:

Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557
and so on...

如同展示的那样,enulator 通过5555端口连接到adb和console【控制台】在5554端口监听到的是同样的内容---------------------à(这一段翻译的太烂)

一旦server和所有的emulator建立起连接,你可以使用adb命令去access【访问】他们。因为server管理着emulator/device连接的实例并且接受从多个client发来的命,你能控制任何emulator/device通过任何client(或脚本)。---------------------à(这一段翻译的太烂)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值