Javascript debugging entirely on Android Device

As a web developer, I have to use console.log(...) a lot to see what's going on with my javascript web application. I had to debug a javascript page on my Android (HTC Desire running Android 2.2) phone, and needed to look at the console output.

Initial searches brought up Debuggin JavaScript on Android, a blog post that suggesting using the Android SDK, plugging my phone into my computer, setting up the debug bridge, etc. This sounded like a lot of work.

There is a way to do javascript debugging entirely on your phone without needing the Android SDK.

Download a log view from the android market (e.g. search for logcat). This shows all log messages. Most logcat viewers will let you search/filter, so search for "browser". All console.log messages will come up there.

One difference from Firebug/Chrome Web Inspector: The Android web browser only prints the first argument to console.log(...), so you should do console.log("here's my variable "+var); rather than console.log("here's my variable ", var);

This entry is tagged: