Blog Details

  • Home
  • Debug your apps without using the USB cord
banner
banner
banner

Constantly using your phone while debugging is inconvenient and damaging. I mean, think about it! Carrying all those accessories along while presenting your app? Or for that matter, battery issues that happen when your phone is constantly connected to the USB cord 24/7.

This ‘unhealthy relationship’ between your phone and the USB cord could create ‘unresolved issues’ in the future, which might end up something like this.

200w.gif

We hope not!

Bur guess what? You don’t need the data cable anymore, you can simply do it with WiFi!

We’ll show you how to do it.

Before starting, please make sure that the adb host computer and the android device are on the same WIFI network and choose an access point whose firewall is configured to support adb.

Step 1: Open the Terminal window on Android Studio and fire the below command.

app-without-using-usb.png

Output: restarting in TCP mode port: 5555

<u>Note: For the next command, your ip address is required, which you can find out in 3 ways.</u>

  1. Settings->About Phone -> Status -> IP Address

OR

  1. Step 1: adb shell Step 2: netcfg

OR

  1. By writing a small piece of code in java class file

WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);

String ip = ;

Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());

Step 2: When you go back to the terminal window, fire the following command.

adb connect “your device ip address”:”the port you want to connect to”

That’s it! You can now disconnect the USB and continue with wireless debugging.

If you’re one of those who likes to get things done, instead of putting

If you’re one of those who likes to get things done, instead of putting in the manual work.

You can simply install the Android WiFi ADB plugin. Here’s how to do it.

Go to File -> Settings -> Plugins -> Search ” ADB WIFI ” and install it. You will now see an Android WIFIADB icon on the Toolbar.

Visit https://plugins.jetbrains.com/plugin/7856-adb-wifi for more details

It is always recommended to avoid using this on UNSAFE public networks as anyone in your network can connect to your device in the debug mode. Switching back to your normal USB cable mode is easy. All you have to do is type:

** adb -s “your device ip address”:”the port you want to connect to”**