Remote Debugging on Android Chrome: Missing Developer Tools and Issues on Debian 7

I've spent a couple of hours today trying to set up remote debugging on Chrome on my Samsung Galaxy Note 3. It is an extremely useful feature as it allows one to debug XHTML/CSS/JS issues affecting a mobile browser. However, setting it up turned out to be much more difficult than I expected because most of the documentation I found was either out of date or incomplete. I'm summarising what I've found here in case it helps someone.

The official documentation and how-to is at https://developers.google.com/chrome-developer-tools/docs/remote-debugging. However, the Developer tools option no longer exists in the Chrome browser on Android. I've found that you don't need to enable it at all, so it's enough to get the ADB extension for Chrome on the desktop machine and enable USB debugging on the phone. (Please note that on Android 4.2 and newer versions, the Developer options is hidden. To make it appear, go to Settings > About, tap Build number seven times, then tap Back.)

With these in place, I could get remote debugging work on a Windows machine. However, on Debian 7, the options in the ADB menu in Chrome appeared to do nothing at all. I have found http://stackoverflow.com/questions/19665688/chrome-adb-extension-not-working-on-debian-7 which explains how to set up access the USB device. My user was already in the plugdev group, so the only thing I could do was to set up a persistent rule, but it didn't appear to make any difference.

But it turned out that the ADB extension was not working for others on Linux, either. The bug report at https://github.com/GoogleChrome/ADBPlugin/issues/20 suggested that I could start ADB using a command-line tool after installing the packages ia32-libs and libncurses5:i386, but I had to hunt around for the executable a bit. In the end, I found it in ~/.config/google-chrome/Default/Extensions/[...]/[VERSION]/linux. (I guess it might be somewhere else if you get ADB as part of the SDK.) The adb_command.sh file in this folder hinted that I needed to make adb executable. Then, running adb devices seemed to report the presence of my phone (offline), but I didn't know how to proceed.

Fortunately, the post at http://wesbos.com/remote-debugging-mobile-chrome-android/ explains that one needs to run adb forward tcp:9222 localabstract:chrome_devtools_remote and then one can navigate to chrome://inspect/ in Chrome on the desktop machine to start inspecting the page shown on the mobile. It worked! You can also run adb kill-server to stop ADB.

Popular Posts