Android's adb service listens to USB by default. Generally, we connect to the target machine through USB during development. However, if the target machine has only one USB port, what should we do if we need to use this USB port for other purposes (such as OTG port USB flash drives? In fact, adb supports access through the network. When necessary, you only need to follow the steps below to connect to the adb service through the network.
(1) connect to the target machine through USB normally first, and execute adb shell to access
(2) set the adb listening port: # setprop service. adb. tcp. port 5555
(3) Use the ps command to find the adbd pid
(4) Restart adbd: # kill-9 <pid>. This pid is the pid found in the previous step.
After the adbd is killed, the Android init process automatically restarts the adbd. After the adbd is restarted, it finds that the service. adb. tcp. port is set, and the network request is automatically changed to listening (in this case, it cannot be connected through USB ). In this case, you need to use the following command on the Development host to connect to the target machine:
Adb connect <ip >:< port> www.2cto.com
This ip address is the ip address of your target machine, and port is the port number set in step 3 above (in the above example, it is set to 2nd, of course you can also change it to another value ).
After that, the software may be debugged normally. At this time, the USB interface is empty and can be used for other purposes.
Author: t12x3456