How to connect Android or iPhone via WiFi to adb + Xcode

Developing mobile apps using Apache Cordova or any other platform involves constantly deploying your app to real devices. This process can become tedious because the phone or tablet must be connected via USB cable to your computer. However, you can connect your device via WiFi and deploy and debug your app normally following these steps.

WiFi Android iPhone Apple Phonegap

Connecting Android via WiFi to adb

  1. Connect your device normally via USB cable and open a command prompt.
  2. Ensure the connection is successful by typing adb devices
  3. Type adb tcpip 5555 to switch ports.
    1. If another device is already connected, specify the target device as follows: adb -s DEVICE_ID tcpip 5555, where DEVICE_ID is the device name shown by adb devices.
    2. You’ll get the message: restarting in TCP mode port: 5555 after a few seconds.
  4. Find out the device’s current WiFi IP address. Since Android keeps changing the GUI, the process of locating the IP depends on your android version, you can try:
    1. Tap and hold the WiFi icon and tap your current network.
    2. Go to WiFi > Advanced, and locate the IPv4 address label.
  5. Disconnect the USB cable.
  6. Type adb connect 192.168.0.x to connect the device wirelessly.
  7. Type adb devices to check if your device was connected succesfuly.
android 5 wifi IP

How to find out your IP in newer Android devices

Below is a sample command line with the previous commands executed. The device is now connected by WiFi and you can deploy and debug your apps normally, without cables.

Steps to connect your Android device via WiFi.

To disconnect, type adb disconnect  in the command line, or restart your device.

Troubleshooting

If your device does not appear in the list, or you get connection errors, restart either Windows and / or the device itself and retry the process.

Connecting iPhone via WiFi to Xcode

  1. Connect your device normally via USB cable
  2. Open Xcode and go to Window > Devices and Simulators
  3. Check the Connect via Network option and wait a few seconds
  4. Disconnect the USB cable
  5. Your device should still appear in the Devices list while connected via WiFi

Xcode Devices and Simulators

Troubleshooting

If you receive errors connecting the device via WiFi or it does not appear to be connected anymore, restart the device and Xcode. If the problem persists, try to restart your Mac as well.

Disclaimer

The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.