Hello folks, I am back with yet another post in the Solving Technical Series. Android developers use the ADB interface to debug their apps, and polish it until they release it. In a world full of wires, when a developer wants to break free from wires and do debugging over wireless modem on his phone, he has only one option : do debugging over WiFi. This option works only if he is on a custom ROM based on CyanogenMod/LineageOS or has his original ROM rooted and using 3rd party apps.
Consider India. The release of Jio in the market has proven to be a boon to the users. So nowadays, Jio users do not want to connect their devices to WiFi. They’d rather connect these devices to the mobile hotspot.
In this scenario and other similar scenarios, things are slightly complex for Android Developers who want to use ADB over mobile hotspot. I searched through Stack Overflow and other relevant sites on how to do this. Out of the search results, one worked partially, others never worked. Here are the pages I am refering to 1 (partially worked) , 2 , 3
The first one partially worked, sometimes but not everytime. I was scratching my head until I came upon this app
- The above mentioned app
- ADB enabled on your phone
- A rooted phone (Important, without which there is no use of doing this)
I ran this app, then enabled the toggle, finally saw something like this below:
It is showing an IPv6 address, which cannot be used to connect to ADB if the Android is not Nougat or above. That is where I was doomed. My Redmi Note 3 was running a custom ROM over Marshmallow (using a Nougat theme via CMTE, in case you were wondering of that icon).
But having a small experience in MAC address spoofing, I knew some Linux commands. The first thing I did was to connect my phone via USB to the laptop. Then I connected it to the ADB shell (
adb shell). Then I ran
ifconfig. There I can see a list of Modems in my phone. What I am concerned with is dummy0 (as shown in the screenshot) and wlan0.
As you can see in the screenshot there is an IPv6 address for dummy0 and IPv4 and IPv6 addresses for wlan0. So I ran
adb connect <IPv6 addr> of both the modems. Luck failed. But then I ran
adb connect for the
inet addr of wlan0, which is coincidentally an IPv4 address. When I did that, booom….
Connected to 192.168.43.1:5555
STEPS TO GET ADB OVER HOTSPOT WORKING
- Connect phone to PC via USB
- Connect your device to ADB
adb shell ifconfig. Note the
inet addrvalue of
- Disconnect the phone
Now remember the value of the
inet addr . This is important. Now whenever you want to connect ADB over hotspot:
- Enable the toggle in the app
adb connect <value of inet addr>. Then it must show connected to
Now you can do whatever you like.
Please share this article, and let this get maximum reach. Android developers connected in the wires want to break free from this one day. So please, help developers make the world a better place.
Just to test my curiosity, I installed Android 7.1.2 on my device just to test this. Seems like connecting via an IPv6 address still didn’t work for me. Although connecting through this app and then following the steps above did the job for me.
It seems there are relatively easier steps to connect to adb when your PC is connected to the same mobile’s hotspot
- Plug in your phone to the PC and connect
- Run adb tcpip 5555
- Disconnect your phone
- Now run adb kill-server && adb connect 192.168.43.1
You can now have ADB over hotspot enabled for eternity, unless your battery dies down, or you disable the developer options.