乐闻世界logo
搜索文章和话题

How can I connect to Android with ADB over TCP?

1个答案

1

Step 1: Ensure your device and computer are on the same network

First, ensure your Android device and the computer you're using to connect are on the same local network, such as connected to the same Wi-Fi network.

Step 2: Enable Developer Options and USB Debugging

  1. On your Android device, go to 'Settings'.
  2. Scroll down and find 'About phone', then tap 'Build Number' seven times until you see 'You are in Developer Mode'.
  3. Return to the Settings menu, find and enable 'Developer Options'.
  4. Enable 'USB debugging'.

Step 3: Connect the device via USB and authorize the computer

  1. Connect the Android device to the computer using a USB cable.
  2. If a dialog box appears asking 'Allow USB debugging?', select 'Allow' and check 'Always allow debugging from this computer'.

Step 4: Configure the device for TCP/IP connection

  1. Open the terminal on your computer (for Linux or Mac) or Command Prompt/PowerShell (for Windows).
  2. Enter adb devices to confirm your device is connected and recognized.
  3. Find the device's IP address, which can be viewed in the Wi-Fi settings on the device.
  4. In the terminal or command prompt, enter adb tcpip 5555. This restarts the ADB daemon and listens on port 5555.
sh
adb tcpip 5555

Step 5: Disconnect USB and connect via Wi-Fi

  1. Disconnect the USB connection.
  2. Connect via ADB using the device's IP address; the command format is adb connect <device IP address>:5555.
sh
adb connect 192.168.x.x:5555

Step 6: Verify the connection

Enter the adb devices command; if everything is set up correctly, you should see a line like 192.168.x.x:5555 device, indicating the device is connected via Wi-Fi.

This completes the process of connecting to an Android device using ADB over TCP/IP. If the connection fails, check firewall settings or confirm the device IP address is correct. We hope this helps you complete the setup successfully.

2024年8月5日 02:12 回复

你的答案