Android debug Bridge

Source: Internet
Author: User

ADB, short for Android debug bridge, is a tool in the android SDK. It can be used to directly manage Android simulators or real Android devices.

Three Components
  • Client: run on our development computer. You can run the ADB command to start the client. Other Android tools, such as the ADT plug-in and ddms, can also create a client.
  • Server: As a backend program running on our development computer, it is responsible for communication between the client and the ADB daemon (deamon) on the simulator or mobile device.
  • Deamon: the ADB process that runs in the background of a simulator or mobile device.

 

Main functions
  • Quickly update the code in a device or mobile phone simulator, such as an application or Android system upgrade;
  • Run shell commands on the device;
  • Manage the ports on the device or mobile phone simulator;
  • Upload and download files on a device or mobile phone Simulator

 

Operating principle

The startup process is as follows:

  • The server starts binding port 5037 of the local machine. The client uses 5037 to communicate with the server.
  • Any deamon will take two consecutive ports from 5555 to 5585. The odd port is responsible for connecting to ADB, and the even port is responsible for connecting to the console. The server scans the odd ports between 5555 and 5585 to find the simulator or device instance and establishes a connection with the found port.

Once the server is connected to all simulators or devices, you can use the ADB command to control and access these instances. Because the server manages connections to simulators/device instances, and controls commands to process from multiple DBC clients, you can control any simulator/device instance from any client (or script.

The following sections describe how to use ADB and manage the status of simulators/devices through commands. Note that if you use eclipse with the ADT plug-in to develop Android applications, you do not need to use ADB through the command line. The ADT plug-in has transparently integrated ADB into Eclipse IDE. Of course, if necessary, you can still directly use the ADB command, such as debugging.

Issue ADB command

You can use the ADB command in the command line or script of your development machine:

$adb [-d|-e|-s ] 

After you enter the command, the ADB client is started and the client is not related to the simulator/device instance. Therefore, if multiple modules/devices are running, you need to use the-D option to identify the target instance for command execution.

ADB command
Options:
-D: only use the USB interface to manage Abd.
-E: the ADB is managed only through the simulator instance.
-S: Use the allowed command numbers of the simulator/device to send commands to manage the ADB
General:
Devices: view the list of all devices connected to the simulator/device.
Version: view the version serial number of the ADB.
Logcat [] []: outputs log data to the screen
Bugreport: View bug reports, such as dumpsys, dumpstate, and logcat.
Push: Copy local files to simulators/devices
Pull: Copy files from the simulator/device to the local device.
Install: copy the local APK package to the simulator/device and install shell: log on to the device. Run the shell command.
Scripting:
ADB wait-for-device-blocking ADB server direct device availability
ADB start-server-start ADB Server
ADB kill-server-Disable ADB Server
ADB get-state-print information: offline | bootloader | Device
ADB get-serialno-print information:
ADB status-window-constantly print the status information of the specified device
ADB remount-re-mount the/system partition on a read/write Device
ADB reboot [bootloader | recovery]-restarts the device and selectively enters the bootloader or recovery mode.
ADB root-use root permission to re-ADB
More ADB info:
ADB help


References: http://developer.android.com/guide/developing/tools/adb.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.