Prerequisite: The computer has been connected via USB cable and the driver has been successfully installed.
The ADB connects to the phone for debugging in two ways, one using a USB cable and the other using wireless WiFi.
First connection using USB cable
1. Enable USB debugging on the phone
2. Open the DOS command window, enter CD D:\Android\sdk\platform-tools return
3. Re-enter the ADB devices, and you can see your connected device.
PS: When you cannot see your device, check whether USB debugging on your phone is turned on, or if you have a mobile phone driver installed on your PC.
The second use of wireless WiFi connection
First, learn a little bit about the underlying knowledge:
The Android system is running a service (ADBD), which responds to and manages the ADB command connection on the computer side, which listens to one of the USB connections or networks at startup based on the configuration of the phone. The configured properties are: Service.adb.tcp.port, which is the listening network port
- The value of the above attribute > 0:adbd will listen to the network corresponding port (typically 5555)
- The value of the above attribute <=-1:ADBD will listen for USB
Next is the connection step:
Command line input: ADB connect (IP): 5555
Tip: Unable to connect to (IP): 5555
Workaround:
1) Connect the phone to the PC and execute the following command: ADB tcpip 5555
Success prompt: Restarting in TCP mode port 5555
Then disconnect the USB
Error tip: Error:device not found
Check whether USB debugging on your phone is on, or if your PC has a phone driver installed.
2) then execute ADB connect (IP): 5555, this time should be able to connect successfully
Success prompt: connected to (IP): 5555
After debugging is complete, enter the following command to disconnect:
ADB disconnect (IP): 5555
Connect your phone with an IP address using the ADB command