Debugging Firefox on Android

Chen Hui Jing - Mar 14 '23 - - Dev Community

I just figured out how to get my Android phone recognised by Android Debug Bridge (adb) on my MacBook, which finally allowed me to remote debug websites on Firefox Android. Just so I don’t forget what I did, this is a short documentation of the steps needed to get everything to work. Hopefully it will stay relevant for a good while.

Firefox official documentation is actually very clear: about:debugging, however, the first time I tried it, I could not for the life of myself get it to work. ¯\_(ツ)_/¯

  1. Enable Developer menu on your Android device.
  2. Enable USB Debugging in the Android Developer Menu.
  3. Enable USB Debugging in Firefox on the Android device.
  4. Connect the Android device to your computer.

First make sure you have installed Android Debug Bridge from Android Tools on your computer in order for it to be able to connect to your device. You do not need to install the full Android Studio SDK. Only adb is needed.

To install adb, download the SDK Platform Tools from https://developer.android.com/studio/releases/platform-tools.html, there are versions for every OS but I’m using Mac specifically.

After that, unzip the files into an easily accessible folder on your computer. From the command line, navigate to folder and run ./adb devices to see list of devices connected.

If no devices show up, then the issue might be on the Android device side of things. Following the advice from this Stack Overflow post, what worked for both my Android 11 and Android 12 devices was to switch the USB configuration to PTP (Picture Transfer Protocol).

After that running ./adb devices actually did list something.

adb list showing device connected

Go back to about:debugging and refresh the page. If the devices are listed on the command line, they will show up in the left sidebar (at least they did for me).

Setup for remote debugging

Happy debugging! 🪲

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .