ADB over different channels
Time: Aug 2017
System: macOS Sierra 10.12.6
Normally we use USB to send adb commands to the Android devices. However, this is not always an available option, for example, sometimes you want to use the USB channel to do other things like charging the device. Fortunately, we are able to do this over various channels (WiFi, Shared WiFi, Bluetooth) and here is tested solutions.
Prerequisites
Device: Settings > Developer options > USB Debugging turn on
Macbook: adb by installing Android SDK
USB: Simply connect the phone
WIFI: https://developer.android.com/studio/command-line/adb.html#wireless
Shared WiFi
This needs arises when the device is also connected to a VPN and a simple WiFi solution fails to work.
Macbook: Internet sharing > Share you connection from Ethernet to Wi-Fi
Device: rooted (refer to Root Android phones) and connect to the shared Wi-Fi
Install the app "ADB TCP": https://play.google.com/store/apps/details?id=jps.android.adbtcp
tun0 is the VPN interface
wlan0 is the Wi-Fi interface (IP should look like 192.168.2.??)
Default port is 5555
At Macbook
adb connect bbb // by default, it's connecting to 5555
adb devices // check if the connection is successful, if so, the device shows up
Drawback: the Shared WiFi is the very reliable and you need to root the device.The first is problematic when we need to interact with the device continuously and extensively. The latter limitation is that you simply don't want to root the device.
Bluetooth
Turn on tethering by going to Tether Settings > Tethering & protable hotspot > Bluetooth tethering
Almost the same as Shared WiFi instruction, except with a different interface: bt-pan 192.168.44.1
Limitations: This approach only supports one device at the same time. As the bluetooth network can have only one interface in the Macbook.