Its a program running on device which communicates with emulator/device.
It is a client-server program that includes three components:
1. Daemon : running on device or emulator.
2.Client:- running on ur dev machine. invoke by adb command from trminal. ADT plugin or DDMS also creates the adb client.
3.Server:- running as background process on ur dev machine. Manages the communication between the adb daemon and client.
You can find the
adb tool in <sdk>/platform-tools/.
When you start adb it will check and start server if not running. when server starts it binds to local TCP port 5307 and listens for all commands from adb client on it. Server set up connection to all running devices and emulator. It locates emulator/device instances by scanning odd-numbered ports in the range 5555 to 5585, the range used by emulators/devices.
adb [-d|-e|-s <serialNumber>] <command>
- <tty> — the tty for PPP stream. For exampledev:/dev/omap_csmi_ttyl.
- [parm]... — zero or more PPP/PPPD options, such asdefaultroute, local,notty, etc.
Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557
and so on...
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.
server 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).
To start adb deamon at device need to enable developer option on device.
You can issue adb commands from a command line on your development machine or from a script. The usage is:
ex:
adb devices
adb install <apk_path>
adb kill-server
adb connect <device-ip-address>
option meaning
devices list of all attached emulator/device.
help list adb commands.
version Prints the adb version number.
-d Direct an adb command to the only attached USB device.
-e Direct an adb command to the only running emulator instance.
-s <serialNumber> Direct an adb command a specific emulator/device instance (such as "emulator-5556").
logcat [option] [filter-specs] Prints log data to the screen.
bugreport Prints dumpsys, dumpstate, and logcat data to the screen,
jdwp Prints a list of available JDWP processes on a given device.
install <path-to-apk> Install an Android applicationton an emulator/device.
pull <remote> <local> Copies a specified file from an emulator/device to your computer.
push <local> <remote> Copies a specified file from your computer to an emulator/device.
forward <local> <remote> Forwards socket connections from a specified local port to a specified remote port on the emulator/device instance.
ppp <tty> [parm]... Run PPP over USB.
Note that you should not automatically start a PPP connection.
Note that you should not automatically start a PPP connection.
get-serialno Prints the adb serial number string.
get-state Prints the adb state of an emulator/device.
wait-for-device Blocks execution until the device is online — that is, until the instance state is device.
start-server adb server process is running and starts it, if not.
kill-server Terminates the adb server process
shell Starts a remote shell in the target emulator/device instance.
shell [shellCommand] Issues a shell command in the target emulator/device instance and then exits the remote shell.
JDWP is the protocol used for communication between a debugger and the Java virtual machine (VM) which it debugs (hereafter called the target VM).