[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 ...
随机推荐
- hadoop配置机架感知
接着上一篇来说.上篇说了hadoop网络拓扑的构成及其相应的网络位置转换方式,本篇主要讲通过两种方式来配置机架感知.一种是通过配置一个脚本来进行映射:另一种是通过实现DNSToSwitchMappin ...
- gdb注意事项
假设我当前有文件test.cpp,要gdb调试,先shell上执行:g++ test.cpp -o test -g 1. gdb调试针对的文件是debug模式的可执行文件. 上面-g参数即加上debu ...
- Hollister Outlet Store
(link to hollisterco site), It's a major try. After a photographer's viewpoint, Which roughly splend ...
- Scala 编程---类和对象
类是对象的蓝图.一旦你定义了类,你就可以用关键字new从类的蓝图里创建对象.比方说,如果给出了类的定义: class ChecksumAccumulator { // class definition ...
- fatal error: 'XCTest/XCTest.h' file not found
这个报错在几个方面.第一,它导致XCTedt依赖您的应用程序.框架,它只是在Xcode中可用.第二,你使用绝对路径,这并不保证是相同的从Mac Mac(例如,如果你安装了多个版本的Xcode). 这里 ...
- Power of Four(Difficulty: Easy)
题目: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example ...
- C++引用的作用和用法
引用就是某一变量(目标)的一个别名,对引用的操作与对变量直接操作完全一样. 引用的声明方法:类型标识符&引用名=目标变量名: 例如: int q; int &ra=a; 说明: &am ...
- Spearman秩相关系数和Pearson皮尔森相关系数
1.Pearson皮尔森相关系数 皮尔森相关系数也叫皮尔森积差相关系数,用来反映两个变量之间相似程度的统计量.或者说用来表示两个向量的相似度. 皮尔森相关系数计算公式如下:
- Linux安装FTP服务
转自:http://blog.csdn.net/huangbiao86/article/details/6641952 ftp服务器 1. 在Linux和其他机器之间共享文件(在linux下安装ft ...
- ASP.net封装
设计如下: 代码: using System; using System.IO; public partial class 四则运算 : System.Web.UI.Page { protected ...