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.
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.