Jos works as Architect for JPoint. In the last couple of years Jos has worked on large projects in the public and private sector. Ranging from very technology focusses integration projects to SOA/BPM projects using WS-* and REST based architectures. Jos has given many presentations on conferences such as Javaone, NL-JUG, Devoxx etc., and has written two books for Manning: Open Source ESBs in Action and (published in the next couple of months) SOA Governance in Action. In this last book Jos shows how, with some good practical governance approaches, you can create great WS-* and REST based services and APIs. Besides this he has his own blog where he writes about interesting technologies and shares his ideas about REST, API Design, Scala, Play and more. Jos is a DZone MVB and is not an employee of DZone and has posted 51 posts at DZone. You can read more from them at their website. View Full User Profile

Remote Firefox Debugging on Android

08.30.2012
| 4454 views |
  • submit to reddit

In the previous article I wrote about remote debugging web applications using chrome on Android. If you don't want to use chrome or you want to test and debug your application on a different mobile browser you can also use firefox mobile to debug. The process is pretty much the same as for chrome.

  1. Connect your mobile device with USB to your desktop computer
  2. Setup your mobile firefox for remote debugging
  3. Configure your desktop browser for remote debugging
  4. Connect desktop browser to mobile browser and start debugging

To start debugging you have to connect your mobile device using USB to your desktop. Once you've done this you can use the android 'adb' tool to setup a debug connection to your tablet or phone. If you need instructions on how to setup 'adb' see the previous article on chrome.

Setup your mobile firefox for remote debugging

Open your mobile firefox (make sure you've got the latest firefox mobile beta) and enter "about:config" in the url. This will open a screen where you can edit settings. In this screen set the "devtools.debugger.remote-enabled" to "true":

Screenshot_2012-08-08-17-19-30.png

Now restart firefox, and that's it for this part.

Setup your desktop firefox for remote debugging

Next we need to configure firefox on your desktop for remote debugging (I'm using a nightly build). Once again go to the "about:config" url. This time set the "devtools.debugger.remote-enabled" property to true.

about_config-1.png

Restart your browser and now you'll have a new entry in the "tools->web developer" menu called "Remote Debugger"

Connect desktop browser to mobile browser and start debugging

Now you're pretty much ready to start debugging. We mentioned at the start that we're going to use android's adb tool to set up the debug channel. To do this, run the following command:

jos@Joss-MacBook-Pro.local:~/dev/android-sdk-macosx/platform-tools$ ./adb forward tcp:6000 tcp:6000
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
jos@Joss-MacBook-Pro.local:~/dev/android-sdk-macosx/platform-tools$ 

Now point the browser on your mobile device to the page you want to debug and open your firefox on the desktop. On your desktop firefox select the "tools->web developer->Remote Debugger" option. Just click enter on this popup:

Nightly.png

When you do, you'll see another popup appear, but this time on your mobile device.

Screenshot_2012-08-08-17-21-50.png

You've got a couple of seconds to click the Ok button, and once you do, a remote debugging session will be created. From your desktop you can now set breakpoints, view scripts etc.

View code:
Nightly-1.png

Set breakpoints:
Nightly-2.png

And that's it! Very easy, and another great way to make debugging web/html applications on your mobile device easier. In the next couple of days, I'll also show how you can do this with Opera.

Published at DZone with permission of Jos Dirksen, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)