Follow the below steps:
- Connect the device via USB and make sure debugging is working;
adb tcpip 5555. This makes the device to start listening for connections on port 5555;
- Look up the device IP address with
adb shell netcfgor
adb shell ifconfigwith 6.0 and higher;
- You can disconnect the USB now;
adb connect <DEVICE_IP_ADDRESS>:5555. This connects to the server we set up on the device on step 2;
- Now you have a device over the network with which you can debug as usual.
To switch the server back to the USB mode, run
adb usb, which will put the server on your phone back to the USB mode. If you have more than one device, you can specify the device with the
adb -s <DEVICE_IP_ADDRESS>:5555 usb.
No root required!
To find the IP address of the device: run
adb shell and then
netcfg. You’ll see it there. To find the IP address while using OSX run the command
adb shell ip route.
WARNING: leaving the option enabled is dangerous, anyone in your network can connect to your device in debugging, even if you are in the data network. Do it only when connected to a trusted Wi-Fi and remember to disconnect it when done!
@Sergei suggested that line 2 should be modified, commenting: “-d option needed to connect to the USB device when the other connection persists (for example, emulator connected or other Wi-Fi devices)”.
This information may prove valuable to future readers, but I rolled-back to the original version that had received 178 upvotes.
On some device you can do the same thing even if you do not have an USB cable:
2. adb connect <DEVICE_IP_ADDRESS>:5555
3. Disable the setting when done
Using Android Studio there is a plugin allowing you to connect USB Debugging without the need of using an ADB command from a terminal.
How to run, install and debug Android applications over Wi-Fi?
(No root required) There is one best, easy and with UI method for Android Studio
IntelliJ and Android Studio plugin created to quickly connect your Android device over WiFi to install, run and debug your applications without a USB connected. Press one button and forget about your USB cable.
just install plugin Android WiFi ADB
Download and install Android WiFi ADB directly from
Intellij / Android Studio: Preferences/Settings->Plugins->Browse Repositories
Remember! for first time to initialize the device you must have to connect using usb
Alternatively, you can download the plugin from the JetBrains plugin site and install it manually in: Preferences/Settings->Plugins->Install plugin from disk.
You can connect and manage your devices easily.
If you want to enable wireless adb on the device without connecting with a USB cable at all (root required):
- Install a terminal app on the device (like Android Terminal Emulator) Type the following
- setprop service.adb.tcp.port 5555
- stop adbd
- start adbd
Since you already have the terminal opened, you can find the IP address of the device:
ip addr show
Then in your debugging environment run command:
adb connect ip.of.the.device
This will make the device to be listed as any other emulators you might have. Note that the TCP will stay opened until you reset the device. You might also want to install a Wi-Fi Keep Alive app if you often experience disconnects.
Remember to close the TCP when connecting to public networks if you want to feel safe. You can do the following or simply restart the device:
- setprop service.adb.tcp.port -1
- stop adbd
- start adbd
To run, install and debug Android applications over Wi-Fi, follow the following steps:
- Connect Android device and adb host computer to a common Wi-Fi network accessible to both. We have found that not all access points are suitable; you may need to use an access point whose firewall is configured properly to support adb.
- Connect the device with USB cable to host.
- Make sure adb is running in USB mode on host.
$ adb usb restarting in USB mode
- Connect to the device over USB.
$ adb devices List of devices attached ######## device
- Restart host adb in tcpip mode.
$ adb tcpip 5555 restarting in TCP mode port: 5555
- Find out the IP address of the Android device:
Settings -> About tablet -> Status -> IP address. Remember the IP address, of the form
#.#.#.#.sometimes its not possible to find the IP-address of the android device, as in my case. so u can get it using adb as the following: $ adb shell netcfg and the should be in the last line of the result.
- Connect adb host to device:
$ adb connect #.#.#.# connected to #.#.#.#:5555
- Remove USB cable from device, and confirm you can still access device:
$ adb devices List of devices attached #.#.#.#:5555 device
You’re now good to go!
If the ADB connection is ever lost:
- Make sure that your host is still connected to the same Wi-Fi network your Android device is.
- Reconnect by executing the “adb connect” step again.
- Or if that doesn’t work, reset your adb host:
and then start over from the beginning.
If you are using Android 11 click on the build version many times to activate the developer option then go to Settings>Advanced>Developer options. Scroll to debugging and turn on the “Wireless debugging” checkbox. Then open the menu debugging by touching the “Wireless debugging”. Select “Pair device with paring code” and you will see the address for pairing with a pairing code. write this command in your desktop terminal to pair with your Android device.
adb pair 192.168.XXX.XXX:XXXX <--------- the address showing on screen under paring code
Use the paring code to connect.
But wait we are not connected to adb yet. After you have successfully paired your device once. You can connect your adb anytime you turn on your Wireless debug option. To connect your adb every time before you use it from now on you don’t need the pairing address anymore instead you will use the given address that shows when you enter the Wireless debug menu.
adb connect 192.168.XXX.XXX:XXXX <--- this address shows inside wireless debug menu
Hope you learned something from this post. The primary source of this article is StackOverflow.
Follow Programming Articles for more!