ADB stands for Android debug bridge ).
I. Role of ADB
ADB is a multi-purpose tool used to manage simulators or devices.
Ii. Composition
ADB is a C/S program. It contains three components: client, server, and deamon.
1. The client runs on our own 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.
2. As a background program, the server also runs on our own computer. It is responsible for communication between the client and deamon.
3. deamon is also used as the backend program, but runs on the simulator instance or device instance.
Iii. Port Problems
1. The server starts binding port 5037 of the local machine. The client uses 5037 to communicate with the server.
2. 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.
4. start and end the ADB Server
1. ADB start-server starts the ADB server.
2. ADB kill-server terminates the ADB server.
3. in Linux, the ADB server needs to run as a root user due to permission issues.
5. View simulators or devices
1. Sometimes you need to determine which devices or simulators are currently available. Run the command ADB devices.
For example:
~ $ Sudo/opt/Android-SDK/tools/ADB Devices
List of devices attachedemulator-5554 deviceht95lkf00945 Device
Two devices are listed here. The first is the simulator and the second is the mobile phone.
Note: the root user is used to start the ADB server and execute the ADB command. Otherwise, "No permissions" appears"
2. If multiple devices are running, you must use the-S,-E, or-D parameters to specify the target device when sending commands.
ADB-e sends commands to the simulator.
ADB-D sends commands to USB devices, such as mobile phones.
ADB-s specifies a target. ADB-S <serialnumber> <command> install <path-to-APK>
Example: ADB-s emulator-5554 install helloworld.apk
6. execute shell commands
ADB shell or ADB shell [<shellcommand>]
The latter will exit after the command is executed. The difference between the two commands is known as a test.
7. Install the APK Program
ADB install <path-to-APK>
8. upload and download files
ADB pull <remote> <local> download files from devices
ADB push <local> <remote> upload files to the device
9. Other functions
Help to view all commands supported by ADB
View the version serial number of ADB
Logcat prints logs to the screen
Bugreport prints dumpsys, dumpstate, and logcat data to the screen
View the available jdwp information of the specified facility.
Forward forward <local> <remote>
Refer to this article: http://blog.chinaunix.net/u1/38994/showart_1912868.html
Get-serialno view the serial number of the ADB instance.
Get-state: view the current status of the simulator/facility.
PPP runs PPP through the use Device
Wait-for-device will not be executed if the device is offline.
From: http://droidke.com/2010/04/01/android-adb.html