How to Use adb through the network in Android underlying development

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.