Chapter 7. Tools for debugging Cordova and other hybrid apps

 

This chapter covers

  • Why debugging is so important
  • Debugging Cordova apps on Android
  • Debugging Cordova apps on iOS
  • Debugging with Weinre

I’ve been programming in some capacity or another since I was around 10 years old. In the 30 years or so of coding I’ve yet to write a computer program 100% correctly the first time. I hope to program for another 30 years, but I have no illusion about my ability to start writing perfect programs.

7.1. Finding the bug is nine-tenths the work of solving it

The absolute most important thing a developer can learn is how to properly debug an application. Things will go wrong. Period. Being able to determine the particular thing going wrong will take you a long way toward fixing it. You may not know how to fix an error, but being able to say “I get this error when I do this action” will give you something to Google where, most likely, you’ll find an answer (probably multiple answers) to your question.

Unfortunately, debugging a Cordova application by itself is somewhat difficult. Normally when something goes wrong, no visible error will be printed to the device’s screen. Instead, the usual response is for nothing to happen. Imagine your GitHub application suddenly becoming broken because of a typo. A user enters something in the text field, clicks Search, and nothing happens. Why? Because of some error that’s invisible to the user.

7.2. A broken app

7.3. Working with Chrome remote debugging on Android

7.4. Remote debugging with iOS and Safari

7.5. Working with Weinre

7.6. Other debugging options

7.7. Summary

sitemap