How to Set Up and Use ADB Wirelessly With Android

  1. Connect Android Phone and Host Machine to the Same Wi-Fi Network: Ensure that both your Android phone and the computer (host machine) are connected to the same Wi-Fi network.
  2. Initial USB Connection:
    • Connect your Android phone to the host machine using a USB cable initially.
    • This step is necessary to set up the initial connection.
  3. Run ADB Commands:
    • Open a command prompt or terminal on your host machine.
    • Execute the following commands:
      adb tcpip 5555
      This command sets up ADB to listen on port 5555 for Wi-Fi connections.
  4. Obtain the Phone’s IP Address:
    • Run the following command to get the phone’s IP address:
      adb shell "ip addr show wlan0 | grep -e wlan0$ | cut -d\" \" -f 6 | cut -d/ -f 1"
      This will provide the IP address of your Android device.
  5. Disconnect USB Cable and Connect Over Wi-Fi:
    • Unplug the USB cable from your phone.
    • Now, run the following command to connect to your phone over Wi-Fi:
      adb connect <ip_address>:5555
      Replace <ip_address> with the actual IP address obtained in step 4.
  6. View Logcat Output:
    • You can now view logcat output by running:
      adb logcat
    • Alternatively, you can use the Android Monitor tab within Android Studio.

Remember that this method allows you to debug wirelessly without relying on a USB connection. Enjoy debugging without the hassle of cords!