How to run/install/debug Android Apps over Wi-Fi on your device?

a robot holding a cable next to a smartphohe

7 November 2023 Stephan Petzl Leave a comment Tech-Help

When testing, the most straightforward way to install and run an application on your device is to use a cable and connect your phone to your computer. But what if you would like to connect to your device wirelessly? This would be needed for example if you want to test an app that uses a cable to communicate with other hardware, such as an external keyboard. Here’s a guide on how to test Android over wifi (rooting your device is NOT required).

Steps to make your device available via Wi-Fi

Wireless debugging changed a bit with Android 11.

Wireless debugging on Android 11 and higher:

You need to make sure that you have an up-to-date version of ADB. You can check your adb version using adb --version

Make sure you got at least Android Debug Bridge version 1.1.0 or higher.

Then enable wireless debugging:

For a Google Pixel phone:

  1. Enter Settings > System, then open Developer options.
  2. Activate the Wireless debugging switch and select Allow on the prompt.

For a Samsung phone:

  1. Visit Settings, navigate to Developer options, and flip the Wireless Debugging switch.
  2. Click Allow on the prompt to turn it on.

For a OnePlus phone:

  1. Go to Settings > Additional Settings and open Developer options.
  2. Activate the Wireless debugging option by tapping the toggle, then select Allow to enable it.

Wireless debugging on Android 10 and below:

  1. Make sure ADB (Android debug bridge) is installed. It’s part of the Android SDK Platform Tools and can be downloaded from here.
  2. In any case, you need to connect your device physically via a cable first. There is no way around it: Connect your device to your desktop via cable
  3. Enable “Developer Options” and “USB debugging” on your device. You can find a guide on how to do that here.
  4. Executeadb tcpip 5555 in a terminal -> The device will start listening for connections on port 5555
  5. Look up the device IP address by executing adb shell netcfg or adb shell ifconfig with Android 6.0 and higher;
  6. You can disconnect the USB now;
  7. adb connect <your device IP>:5555. This connects to the server we set up on the device in step 3;
  8. Executeadb devices and you will see that the device is available remotely through ADB now

How to switch back to USB cable mode?

To switch back to USB cable mode, run adb usb.

If you have more than one device, you can specify the device with the -s option: adb -s <your device IP>:5555 usb.

Important: Leaving the option enabled is dangerous, anyone in your network can connect to your device in debug. Do it only when connected to a trusted Wi-Fi and remember to disconnect it when done!

On some devices, such as emulators (AVDs) you can do the same thing even if you do not have a USB cable:

android wireless install app

What if I can’t connect via a cable at all?

First of all: Establishing a wifi connection without any cable only works on a routed device. If your device is not rooted and you can’t connect via a cable, you are out of luck. There are Android security constraints that won’t allow you to connect.

But if your device is rooted, you can do the following:

  1. Install a terminal app on the device (like Android Terminal Emulator)
  2. Then enter following commands into the terminal:
    su
    setprop service.adb.tcp.port 5555
    stop adbd
    start adbd
  3. Use this command to find the IP address of your device:
    ip addr show
  4. On your desktop, open a terminal and execute:
    adb connect <your device IP from step 3>
  5. check via ADB devices if your device is listed

Important: For safety reasons, remember to close the TCP port. You can do the following or simply restart the device:

su
setprop service.adb.tcp.port -1
stop adbd
start adbd

Conclusion

To test Android over wifi there are a few steps needed, however it’s totally possible. Even though the most common solution is still to test devices via cable, especially because it’s the most secure way of testing. Android testing tools like Repeato will help with that.

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