Tuesday, December 27, 2011

[How to] Use error console in Native UI for Firefox on Android

Developers use different techniques for debugging their web applications. Though there are lots of new techniques coming up in this space, one technique which is still widely used is console logging. Every browser (including the mobile browsers) supports this feature in some capacity. I have been using Firefox on my Nexus One and it has an in-built error console which can be enabled from about:config.  However, with the new native UI for Firefox on Android, this option does not seem to be available. Read through this post to find out how you can use error console in the native UI.

Error Console in Firefox Native UI

Firefox Native UI writes all the console messages to Android system log which can be read via logcat which comes along with the Android SDK.

  • Android SDK. Download and install the latest Android SDK from here. This comes up with all the tools needed for development and testing of your application. Once the SDK is installed, go to the location on which the SDK is installed. Run ‘adb logcat’ - this will show the complete log from Android system. To  view Firefox specific log messages, do a grep: ‘adb logcat | grep “Gecko”’. To view Firefox console messages alone, do a grep: ‘adb logcat | grep “GeckoConsole”’.
  • If you don't want to install Android SDK, you can use apps like aLogCat (Android app for viewing the logs). The app provides an option for filtering the logs and also comes with lots of other accessibility options.

Firefox Native UI - Conole logs

Firefox Native UI - Conole logs

-- Varun

No comments:

Post a Comment

google-site-verification: googlea4d68ed16ed2eea6.html