adb - Android Debug Bridge


1. Overview
adb is the Android Debug Bridge , which is the Android Debug Bridge, which is used for the connection between Eclipse and mobile devices or emulators.
When Eclipse starts, adb.exe is also started as a background server. You can see adb.exe through Windows Task Manager.

Second, using adb
adb is not only responsible for connecting computers and mobile devices, but also provides operations such as installing and uninstalling apk files. , these operations need to operate in the DOS environment.

adb.ext is located under ...\sdk\platform-tools; the environment variable has been set for this path in Chapter 01, so you can use adb in any directory in the DOS environment

1. Restart adb
In some cases, adb There may be a problem, and the normal connection between the computer and the device cannot be guaranteed, so you need to restart adb.
In the DOS environment, execute the following two commands in order:
adb kill-server: Disconnect the emulator from the computer
adb devices: List the devices, that is, start

adb
, prompt: Port 5037 is occupied, please check whether there is software such as Thunderbolt occupying port 5037, check method:
Step 1. Enter netstat -ano under DOS
Step 2. Find the PID of the process occupying 5037
Step 3. Open Windows Task Manager, click "View" in the menu bar, click "Select Columns", and check "PID".
Step 4. Switch to "Process" and find the process
prompt whose port number is 5037:
    Normally, the process should be eclipse.exe. If other processes also occupy 5037, kill the process in the task manager to solve the above problems.

3. To install apk ,
enter and install xxxx.apk
under DOS .



 


Relevant DOS commands to operate adb
1) adb devices
function: connect the emulator to eclipse and see which emulators are in the debug bridge

List of devices attached
emulator-5554 device
where the number represents: the port number, that is, this emulator Occupies port 5554

2) adb kill-server
function: disconnect the emulator from eclipse

3) adb start-server
function: restart

the service 4) adb install -r apk path \xxx.apk
-r option means: If the application to be installed already exists on the mobile phone, overwrite the installation of the application. If there is no -r and the installed application already exists on the mobile phone, then it cannot be said that the application is installed on the mobile phone
: Overlay installation of the application

5) adb uninstall apk name
for example:
C:\Users\asus>adb uninstall com.jxust.day01_02
Success

This will delete my com.jxust.day01_02 application from the emulator

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326885665&siteId=291194637