Connect Android device wirelessly (over Wi-Fi) to your machine

When you want to run tests on android devices, you have to connect your phone(s) to your test running machine. Adding and removing different devices to your machine is a bit of a headache and it looks messy as well. So if you want to connect your android device to your machine over Wi-Fi (wirelessly) you can do the following.

  1. First connect your device to your test machine
  2. From the command prompt/terminal, run the command
  3. adb devices  (you should see the connected device to your machine)
  4. Make sure that your device and your test machine are in the same network.
  5. Run the command 
  6. adb tcpip 5555
  7. You will see a message saying “restarting in TCP mode port: 5555”
  8. Disconnect the device from your machine
  9. Get the IP address of your phone (Go to Settings > Wi-Fi > Your Connected Network > IP Address)
  10. You may have to long tap your network name to see the IP Address, depending on your android version
  11. Run the following command to connect adb to your device over Wi-Fi using the given IP Address
  12. adb connect <your phone’s IP address>
  13. Your devices should now be connected
  14. You can verify the same by running the command 
  15. adb devices
  16. Now you have connected your device wirelessly to your machine. You can run your Appium tests wirelessly.