How To Connect A Test Device Over WiFi With Android Studio

The following article provides step-by-step instructions on how to connect a test device over WiFi with Android Studio. Testing Android apps will at some point require that real devices are used to ensure that features behave as expected. In Android Studio, tests run on smartphones, tablets or other hardware are known as instrumented tests. For the application under test to be installed and executed on the test device, it needs to be connected to the development PC. The default connection method is via a USB cable which has a few disadvantages. It is however possible to utilise the device’s WiFi connectivity to hook up to the development machine. Using Wifi has a number of benefits

  • WiFi won’t suddenly become unplugged during a test
  • No USB cable to get lost, broken or tangled
  • You can spin 360 degrees in your chair while holding the test device

So then, let’s connect a test device with WiFi.

  1. Get the IP address and serial number of the device from it’s settings menu
    • Settings > About Device > Status >
      • IP address
      • Serial number
  2. Connect the device to the PC via USB
  3. Get the name of the device from the list of connected devices by using adb command at the command line interface
    • “adb devices”
  4. On the development PC enter “adb -s <device name> tcpip 5555” to set the port for the device.
  5. In a terminal window, enter “adb connect <IP Address>:5555”
  6. Now you can unplug the USB cable from the device and test with freedom!


If when attempting to establish a connection to the device, you encounter the message “No connection could be made because the target machine actively refused it. (10061)”, it’s possible that there may be an issue with the port. To overcome this repeat step 4 above with a different port number i.e. 5656 then try the adb connect command with the new port number.

Log in using your favourite account and write your comments here

Loading Facebook Comments ...
Loading Disqus Comments ...

Leave a Reply

Your email address will not be published. Required fields are marked *