Wireless Debugging Connection to Use "adb" Tool

This section provides a tutorial example on how to create a wireless debugging connection to run debugging commands using the 'adb' tool.

If you are tired of use the USB debugging connection to run "adb" commands, you can try the wireless debugging connection as shown in this tutorial.

Option I - Using Wireless Pairing on Newer Android Phones - This option is for newer versions Android phones that support wireless pairing.

1. Connect your Android phone and your desktop computer to your home Wi-Fi router.

2. Turn on "Developer Options" on your Android phone by going to "Settings > About Phone > Software Inforrmation", and tapping "Build number" 7 times. Yes, 7 times!

3. Turn on "Wireless Debugging" on your Android phone by going to "Settings > Systems > Developer Options", and turn on the "Wireless Debugging" option in the "DEBUGGING" section. You will see the following confirmation message:

Allow wireless debugging on this network?

Network Name (SSID) "********"
[x] Always allow on this network

[Cancel] [Allow]

4. Check "Always allow..." and tap "Allow" to authorize the connection.

5. Tap "Wireless Debugging" to connection details:

Device name: moto g stylus

[Pair device with QR code]

[Pair device with pairing code]

(list of paired devices)

6. Tap "Pair device with pairing code". You see the paring code displayed:

Pair with device

Wi-Fi paring code: 123577
IP address & port: 10.0.0.150:45585

7. Pair phone on your desktop computer by running the following "adb" command with the above IP address/port and paring code:

herong$ ~/Applications/platform-tools/adb pair 10.0.0.150:45585

Enter pairing code: 123577

Successfully paired to 10.0.0.150:45585 [guid=adb-**********-XmxP3G]

8. List connected devices:

herong$ ~/Applications/platform-tools/adb devices

List of devices attached
adb-ZY22GWX96K-XmxP3G._adb-tls-connect._tcp.	device

9. Test the connection by running the following "adb" commands. The output confirms that the connected phone is running Android 12 based on Linux kernel 4.19.191

herong$ ~/Applications/platform-tools/adb shell \
  getprop ro.build.version.release
12

herong$ ~/Applications/platform-tools/adb shell uname -a
Linux localhost 4.19.191+ #1 SMP PREEMPT ... 2023 aarch64

Option II - Using TCP Connection on Older Android Phones - This option is for Android 10 or older phones that do not support wireless pairing. You can also use this option, if you have problems with the above wireless pairing option.

1. Connect your Android phone and your desktop computer to your home Wi-Fi router. And connect the phone with a USB cable to create USB debugging connection.

2. Turn on "Developer Options" on your Android phone by going to "Settings > About Phone > Software Inforrmation", and tapping "Build number" 7 times. Yes, 7 times!

3. Turn on "USB Debugging" on your Android phone by going to "Settings > System > Developer Options", and turn on the "USB Debugging" option in the "DEBUGGING" section.

4. Tap on "OK" on the confirmation prompt and on the authorization prompt.

5. Verify the USB debugging connection,

herong$ ~/Applications/platform-tools/adb devices

List of devices attached
ZY22GWX96K	device

6. Restart "adbd" to listen on a TCP port instead of the USB connection.

herong$ ~/Applications/platform-tools/adb tcpip 5555

restarting in TCP mode port: 5555

7. Disconnect the USB cable from your Android phone.

8. Find the IP address on the phone in "Settings > About Phone".

Device identifiers

IP address: 10.0.0.150
...

7. Reset the debugging connection to the TCP port.

herong$ ~/Applications/platform-tools/adb connect 10.0.0.150:5555

connected to 10.0.0.150:5555

8. Check the new debugging connection. You may see 2 connections: one established over the TCP port, and the other established over the wireless pairing.

herong$ ~/Applications/platform-tools/adb devices

List of devices attached
10.0.0.150:5555	device
adb-ZY22GWX96K-XmxP3G._adb-tls-connect._tcp.	device

9. Test the TCP debugging connection with "-s 10.0.0.150:5555" option to specify the connection.

herong$ ~/Applications/platform-tools/adb -s 10.0.0.150:5555 shell ps

USER   PID  PPID     VSZ    RSS WCHAN   ADDR S NAME
root     1     0 2313104  10368 0          0 S init
root     2     0       0      0 0          0 S [kthreadd]
root     3     2       0      0 0          0 I [rcu_gp]
root     4     2       0      0 0          0 I [rcu_par_gp]
root     8     2       0      0 0          0 I [mm_percpu_wq]
...

Cool, I have successfully created 2 wireless debugging connections from my desktop computer to my Android phone and ready to run debugging command through the "adb" tool. One connection established over the TCP port, and the other established over the wireless pairing.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows System

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

Android Debug Bridge (adb) Tool

 What Is Android Debug Bridge (adb)

 Install "adb" as Part of SDK Platform Tools

 USB Debugging Connection to Use "adb" Tool

Wireless Debugging Connection to Use "adb" Tool

 Debugging Connection to Android Device Emulators

 Commands and Options Supported by "adb"

 "adb install" and "adb uninstall" Commands

 "adb push" and "adb pull" Commands

 "adb shell" - Remote Shell Interface

 Android File Systems

 AboutAndroid - Application to Retrieve System Information

 android.app.Activity Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

 Build Process and Package File Content

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

 Archived Tutorials

 References

 Full Version in PDF/EPUB