The ADB connects to the phone for debugging in two ways, one using a USB cable and one using wireless WiFi.
First connection using USB cable
1. Enable USB debugging on the phone
2. cmd window input adb devices, you can see your own device at this time.
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:
1. Command-line input: ADB connect 172.16.4.37:5555 (: 5555 can be omitted)
Tip: Unable to connect to 172.16.4.37: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
If the phone is not connected to the PC, direct use of the above command will prompt Error:device not found
Then disconnect the USB
2) then execute the ADB connect 172.16.4.37:5555, this time should be able to connect successfully
Success Tip: Connected to 172.16.4.37:5555
2. Enter the ADB devices and get the following tips to show that the connection is successful and can be debugged.
List of devices attached
172.16.4.37:5555 devices
3. After debugging is complete, enter the following command to disconnect:
ADB disconnect 192.168.1.5:5555
4. The last step, you need to reset the listening network port to 1, listen to the USB port (as if not to do this step, directly plug in the USB cable can also be used normally, and this step often prompts could not the Set property, need root permission)
SetProp service.adb.tcp.port-1
Stop ADBD
Start ADBD
Two ways ADB connects to a phone