Concise notes for the impatient learner

Uncategorized

Debug over Wi-Fi in Android Studio

Open the Terminal tool window in Android Studio.

If adb is not in your PATH, navigate to the Android SDK folder and open the platform-tools subfolder.

Connect your device through USB and make sure USB Debugging is enabled (Settings -> Developer Options).

Use the following command to have adb listen on port 5555 on the device

adb tcpip 5555

Disconnect the device from USB.

On your device, navigate to Settings -> About Phone -> Status -> IP Address (exact naming may vary slightly). Here you’ll find the IP address of the device. For Wi-Fi debugging to work, the device must be at an address reachable from your development machine (e.g., on the same wireless network).

To connect to the device, use the following command, where <ip address> is the address found at the previous step

adb connect <ip address>:5555

To confirm the device is connected through Wi-Fi, use the command

adb devices

To expedite these steps, you can record a macro in Android Studio (Edit -> Macros). Record anything you type in the Terminal window. To reuse the macro, open the terminal window and play the macro. All the recorded keystrokes will be replicated. The only thing that may change run to run is the address of the device. To be able to change that, you can stop macro recording before hitting enter at the adb connect command.

For more information refer to the ADB page on the Android Developer site. A useful tutorial can also be found here (I found it after writing this post!).

Leave a Reply