Connecting to Android with ADB over TCP

Connecting to Android with ADB over TCP

22 April 2024 Stephan Petzl Leave a comment Tech-Help

Debugging Android applications can sometimes require more flexibility than what USB connections offer. This is where Android Debug Bridge (ADB) over TCP/IP comes into play, allowing for wireless debugging and a more versatile development process.

Manual Process

For devices with root access, enabling ADB over Wi-Fi can be achieved with a few simple commands. Here’s how:

  1. Open a terminal emulator on your device.
  2. Execute the following commands:
  3. su
    setprop service.adb.tcp.port 5555
    stop adbd
    start adbd
  4. To disable and revert to USB, use:
  5. setprop service.adb.tcp.port -1
    stop adbd
    start adbd

From a Computer with USB Access

Switching to Wi-Fi is even easier if you already have a USB connection to your computer (root not required):

  1. Connect your device to the computer via USB.
  2. Run the following commands from your computer’s command line:
  3. adb tcpip 5555
    adb connect <DEVICE_IP>:5555
  4. Replace <DEVICE_IP> with your actual device IP address.
  5. To disconnect, use:
  6. adb disconnect <DEVICE_IP>:5555

To find your device’s IP address, you can either check in the Wi-Fi settings under Advanced options or use ADB with the command:

adb shell ip -f inet addr show wlan0

To switch back to USB mode:

adb usb

Automating the Process with Apps

There are apps available on Google Play that can automate the process of switching ADB to Wi-Fi mode, such as adbWireless, WiFi ADB, and ADB WiFi. These apps typically require root access and vary in the permissions they require.

Repeato: Streamlining Testing and Debugging

While setting up ADB over TCP can streamline certain aspects of development, another tool that can further enhance your testing and debugging workflow is Repeato. Repeato is a no-code test automation tool that supports both iOS and Android platforms, making it highly versatile for various app frameworks such as React Native, Flutter, and Unity.

With its AI and computer vision capabilities, Repeato allows for quick editing and running of automated tests. Additionally, it integrates ADB commands through script steps, providing a seamless experience for developers who need to automate and debug their apps wirelessly.

Explore how Repeato can complement your development environment by visiting our product page.

Like this article? there’s more where that came from!