Debugging

If you’ve been programming for any length of time, you know that some (most?) of the time, things don’t go the way you expect. What do you do then? Luckily, the same techniques you use to diagnose problems on other platforms can be applied to Android. These include printing messages to the log and stepping through your program in a debugger.

Debugging with Log Messages

The class provides several static methods to print messages of various severity levels to the Android system log:

  • Log.e: Errors

  • Log.w: Warnings

  • Log.i: Information

  • Log.d: Debugging

  • Log.v: Verbose

  • Log.wtf: What a Terrible Failure

Users will never see the system log, but as a developer you can view it in a couple of ways. In Android Studio, the LogCat view is shown at ...

Get Hello, Android, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.