Android Javascript Debugging
Posted on August 12, 2013 • 1 minutes • 150 words
As a web developer, I have to use console.log
a lot to see what’s going on with Javascript in my web applications, and Android Browser does not make this an easy task.
Initial searches brought up articles suggesting use of the Android SDK, plugging my phone into my computer, setting up the debug bridge, et cetera. That’s a lot of work.
There is a way to do Javascript debugging entirely on your phone without the Android SDK.
Install a log viewer from the Android Market (example: logcat). This shows all of your systems log messages. Most log viewers will let you search/filter. Search for the term, “browser”. All console.log
messages will show up using this keyword.
One difference from desktop web inspectors: Android Browser only prints the first argument from console.log
. So instead of:
console.log("here's my variable ", var);
you should write it like:
console.log("here's my variable " + var);