Forums Register Login

How to debug an Android web app

+Pie Number of slices to send: Send
Recently I was experimenting with PhoneGap and the Google Maps Javascript API V3 with the goal of writing a simple web app for Android that incorporates mapping. I quickly learned that unlike web development for web browsers, any errors including syntax errors in my code were silent failures; not even the Android log indicated that a JS error occurred!

When using Firefox there is the wonderful Firebug add-on which allows for easy debugging of web apps running in Firefox. Similar tools exist for other browsers.

Is there a Firebug-like tool for Android's WebView? If not, how do you debug an Android web app?
+Pie Number of slices to send: Send
There are some tools and I will look for them for you because I do not remember them off the top of my head but I want to correct one point. You can use the ADB to find Javascript errors using logcat filters like

adb logcat browser

This will show you browser errors.
+Pie Number of slices to send: Send
 

robi sen wrote:There are some tools and I will look for them for you because I do not remember them off the top of my head but I want to correct one point. You can use the ADB to find Javascript errors using logcat filters like

adb logcat browser

This will show you browser errors.



I just checked and you are correct. I must have missed the error message the first time.

Hopefully there is an easier way to debug an Android web app.
1
+Pie Number of slices to send: Send
There is a Appendix in the book called "Debugging javascript" ;-)
The idea is to use the Web tools that is included in Chrome Desktop. And because Mobile Chrome is heavily based on the regular Chrome you can test your mobile app with the regular Chrome. Offcourse, it is not a 100% reliable method and besides that you should add logging and track these with ADB (and where you also can track regular javascript errors)
+Pie Number of slices to send: Send
 

Sebastien Blanc wrote:There is a Appendix in the book called "Debugging javascript" ;-)
The idea is to use the Web tools that is included in Chrome Desktop. And because Mobile Chrome is heavily based on the regular Chrome you can test your mobile app with the regular Chrome. Offcourse, it is not a 100% reliable method and besides that you should add logging and track these with ADB (and where you also can track regular javascript errors)



Interesting. It's approximately what I ended up doing. Only, I used Firefox and Firebug with a slightly-modified version of my Google Maps JS code.

In the "Debugging Javascript" appendix, do you mention other techniques besides using desktop Chrome?
1
+Pie Number of slices to send: Send
No it's mainly centered around chrome's developer tools but also present JSLint a code quality tool for your JS scripts.
Honk if you love justice! And honk twice for tiny ads!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 7489 times.
Similar Threads
At work, Javascript, CSS, AJAX Code
Detecting an Ajax request
css changes not reflected
simple javascript form
Firefox unable to detect the javascript on onload event
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:18:50.