WiFi Debug
Note: This section is applicable only if you are interested to explore with WiFi. As a beginner, however USB wired connection will get you the MVP faster.
It is possible to connect an android device over WiFi. While the experience is not as smooth as connecting a USB cable, understanding fundamentals of networking concepts helps debug and troubleshoot any connection issues.
Below are steps that can be helpful.
I also found the below two links helpful for first timers.
ADB Commands
adb commands are quite helpful in this context.
There are ton of options for adb - type "adb" in command line and the below options are shown. Few I tried were
- adb get-serialno
- adb get-devpath
- adb get-state (prints: offline | bootloader | device)
- adb usb (back to listening on usb)
- adb tcp
(listen on tcp protocol) - adb root (got an error "adbd cannot run as root in production biulds")
- and so on....
Connect over WiFi
Note: If the mobile device and machine are in the same network (adb client has to communicate with adb daemon running on mobile devices), then experience would be much easlier. I ensure that both of them are connected to the same WiFi connection before doing the below.
- Manually discover the ip address of the device by navigating to Settings > about phone > status .
- OR, Auto discover the ip address with "adb shell...." command. Any devices that have adbd (adb daemon) listening will show up here(You can also check if android debug interface is enabled on your device by going to Settings > Developer Options > Debugging section > Android debugging)
C:\Users\pmacharl>adb tcpip 5555
C:\Users\pmacharl>adb devices
List of devices attached
C:\Users\pmacharl>adb connect 192.168.1.141:5555
connected to 192.168.1.141:5555
C:\Users\pmacharl>adb devices
List of devices attached
192.168.1.141:5555 device
C:\Users\pmacharl>adb shell ip -f inet addr show wlan0
34: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
inet 192.168.1.141/24 brd 192.168.1.255 scope global wlan0
C:\Users\pmacharl>adb usb
restarting in USB mode
C:\Users\pmacharl>adb devices
List of devices attached
You can also choose to make adb listen on another port for eg. 4455.
As you can see below, first the device was connected to the pc/mac in both usb and tcpip (network) mode, hence there were two rows listed. But when I unplugged the usb cable, only the tcpip mode was enabled and hence only one row.
C:\Users\pmacharl>adb tcpip 4455
restarting in TCP mode port: 4455
C:\Users\pmacharl>adb shell ip -f inet addr show wlan0
34: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
inet 192.168.1.141/24 brd 192.168.1.255 scope global wlan0
C:\Users\pmacharl>adb connect 192.168.1.141:5555
unable to connect to 192.168.1.141:5555
C:\Users\pmacharl>adb connect 192.168.1.141:4455
connected to 192.168.1.141:4455
C:\Users\pmacharl>adb devices
List of devices attached
209c6111 device
192.168.1.141:4455 device
C:\Users\pmacharl>adb devices
List of devices attached
192.168.1.141:4455 device