[ADB]ADB(Android Debug Bridge)简介及基础(不包含命令)
"Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device."
ADB作为一个多功能命令行工具,为你与模拟器或者连接到电脑的安卓设备的通讯提供了可能。
"It is a client-server program that includes three components:
- A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
- A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
- A daemon, which runs as a background process on each emulator or device instance.
You can find the
adb
tool in<sdk>/platform-tools/
."
ADB是一个CS架构的程序,它包含三个部件:
- 客户端,运行在你的开发机器上。通过发送adb命令,你可以从shell引用一个客户端。其他诸如ADT插件、DDMS也都会创建adb客户端
- 服务器,该进程运行在开发机器的后台。服务器对客户端和adb后台驻留程序(adb daemon,在模拟器或设备上运行)之间的通讯进行管理
- daemon,在每个模拟器或设备实例后台运行的进程
adb 工具可以在<sdk>/platform-tools/中找到
"When you start an adb client, the client first checks whether there is an adb server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb clients—all adb clients use port 5037 to communicate with the adb server.
The server then sets up connections to all running emulator/device instances. 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 finds an adb daemon, it sets up a connection to that port. Note that each emulator/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 same as the instance whose console listens on port 5554.
Once the server has set up connections to all emulator instances, you can use adb commands to access those instances. Because the server manages connections to emulator/device instances and handles commands from multiple adb clients, you can control any emulator/device instance from any client (or from a script).
Note: When you connect a device running Android 4.2.2 or higher to your computer, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog. This requires that you have adb version 1.0.31 (available with SDK Platform-tools r16.0.1 and higher) in order to debug on a device running Android 4.2.2 or higher."
启动adb客户端后,客户端首先检查adb服务器是否在运行。如果没有,它会启动服务器进程。服务器启动后,其将会绑定本地TCP的5037端口,来监听来自adb客户端的命令。所有的adb客户端都使用5037端口来与adb服务器通信。
然后,服务器与所有正在运行的emulator/device实例建立连接。服务器通过扫描从5555到5585的奇数端口号来定位emulator/device(因此每台机器最多同时连接16台设备)。当服务器找到adb后台驻留程序的端口后,其通过那个端口进行连接。每个emulator/device实例都需要一对连续的端口号——一个控制台连接的偶数端口,和一个adb连接的奇数端口。例如:
模拟器1,控制台:5554
模拟器1,adb:5555
模拟器2,控制台:5556
模拟器2,adb:5557
……
如上所示,通过5555连接到adb的模拟器实例和监听5554端口控制台连接的实例是相同的。
一旦服务器与所有的模拟器实例建立了连接,你就能通过adb命令来访问哪些实例。因为服务器对所有连接到它的实例进行管理而且处理多个adb客户端发送来的命令,所以你可以通过任意的客户端或者脚本来操控任意一个emulator/device实例。
注意:当你连接到电脑的设备Android版本是或者高于4.2.2时,系统会询问是否允许在这台电脑上调试程序,具体是RSA key。增加了些安全性。
p.s.以上内容引用部分来自Google Android
[ADB]ADB(Android Debug Bridge)简介及基础(不包含命令)的更多相关文章
- 用ADB(Android Debug Bridge)实时监测Android程序的运行
监控Android设备上程序的运行,需要ADB的配合,具体ADB工具的介绍以及命令选项可见博客: http://blog.csdn.net/mliubing2532/article/details ...
- adb ( Android Debug Bridge)
adb ( Android Debug Bridge) 是一个通用命令行工具,其允许您与模拟器实例或连接的 Android 设备进行通信.它可为各种设备操作提供便利,如安装和调试应用. adb工具的工 ...
- adb(Android Debug Bridge)安装使用教程
一.说明 adb的db是debug bridge而不是和gdb一样指debug,这意思是说adb不能像gdb那样能一步步调试代码,但可以启到一些类似调试的功能. 下面就针对这些功能进行介绍,本文根据官 ...
- adb(android debug bridge)命令
adb(android debug bridge) adb devices --查看当前连接的模拟器/设备 adb remount --模拟器/设备重新启动,保证能用 adb push src des ...
- adb(Android Debug Bridge)(一)
上一篇介绍的am,pm命令都是基于adb shell下的命令.这节来详细介绍下adb命令. Android Debug Bridge(adb)是一个让你跟模拟器或者android设备通信的多功能命令. ...
- [ADB Shell]Android Debug Bridge常用命令
ADB用法 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important ...
- Android Debug Bridge
Android Debug Bridge Introduction Android Debug Bridge (adb) is a versatile command line tool th ...
- Android Debug Bridge命令介绍[转]
Android Debug Bridge命令介绍 Android Debug Bridge的一些基本命令.这个工具直译过来就是Android调试桥的意思.它提供了强大的特性,例如复制文件到设备或从设备 ...
- 【Android应用开发技术:基础构建】命令行下的Android应用开发
作者:郭孝星 微博:郭孝星的新浪微博 邮箱:allenwells@163.com 博客:http://blog.csdn.net/allenwells github:https://github.co ...
随机推荐
- regexxx
var test={ msg:{ "name":"name","value":"value" }}var str=JSO ...
- keep the bar green to keep the code clean——Junit详解(二)
测试用例&测试套件 举个栗子: 编写MyStack类模拟栈,并对其进行测试用例编写测试: 编写文件删除方法,并对其删除测试. 不再做演示,戳此获取代码 MyStack类: public cla ...
- Eclipse - 修改默认user和类的创建日期
1.找到eclipse.ini文件 2.在文件中找到 -vmargs -Duser.name=xxxxxxxx 3.修改xxxxxxxx为你的名字 4.eclipse中:Window -> Pr ...
- 不安装HALCON下安装运行版U盘加密狗驱动
参考halcon安装指导书 Installation Guide Depending on your operating system, you can install, configure, and ...
- VIM神器打造Javascript开发环境
http://xuyufish.com/vim%E7%A5%9E%E5%99%A8%E6%89%93%E9%80%A0javascript%E5%BC%80%E5%8F%91%E7%8E%AF%E5% ...
- JAVA 中文转GBK内码方法
不能谷歌,百度了很久,没有直接的转换方法,参考 byte[]数组与十六进制字符串与字符串的互相转换 http://blog.163.com/roadwalker@126/blog/static/113 ...
- php __invoke 和 __autoload
当在对象后面添加()时候调用 __invoke <?php class Person { private $name; private $age; public function __const ...
- ibatis入门教程
转载自 http://www.cnblogs.com/ycxyyzw/archive/2012/10/13/2722567.html iBatis 简介: iBatis 是apache 的一个开源项 ...
- 'java'不是内部或外部命令,另一个解决办法
我知道环境变量,也知道搞系统变量.别给我粘那些教程了,我的java路程是C:\Program Files\Java\jdk1.6.0_05谁弄好了把那三个变量和值发出来.... JAVA_HOME=C ...
- Android开源框架:NineOldAndroid
在android3.0以前的版本,要实现动画,一般是使用NineOldAndroid开源框架,之后,就可以直接使用android提供的animation API了. 仔细看过此开源框架后,可看出此框架 ...