[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
adbtool 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 ...
随机推荐
- js动态添加行
<script> $(function() { //增加上传 var addli = function() { var linum = parseInt($(".pic-wrap ...
- 笔记:linux下mysql设置utf-8编码方法
一:查看mysql版本 1.1 mysql –V 在终端界面输入上面命令.显示如下: mysql Ver 14.14 Distrib 5.5.35, fordebian-linux-gnu (x86_ ...
- Tomcat容器虚拟路径设置
1.[官方文档]在tomcat\conf下server.xml中找到 <Host name="localhost" appBase="webapps" u ...
- app标配控制器:UITabBarController
UITabBarController UITabBarController和UINavigationController类似可以轻松的管理多个控制器,底部有一个条,底部条tabBar的高度是49. U ...
- asp.net mvc 防止开放重定向
/// <summary> /// 防止开发重定向,篡改returnurl /// </summary> /// <param name="request&qu ...
- NoClassDefFoundError
//Java对象转化json格式 public static void toJsonByJettisonMappedXmlDriver(){ try { User user = getUser(); ...
- java基础之 多态
在面向对象编程(Object-Oriented Programming, OOP)中,多态机制无疑是其最具特色的功能,甚至可以说,不运用多态的编程不能称之为OOP.这也是为什么有人说,使用面向对象语言 ...
- HTML5资料
1 Canvas教程 <canvas>是一个新的用于通过脚本(通常是JavaScript)绘图的HTML元素.例如,他可以用于绘图.制作图片的组合或者简单的动画(当然并不那么简单).It ...
- c语言-四阶龙格-库塔法
#include<stdio.h> #include<math.h> #define n 14 //double func1(double x, double y); doub ...
- Queue Reconstruction by Height
Suppose you have a random list of people standing in a queue. Each person is described by a pair of ...