Uh-oh! — Responding to Errors

You wrote perfect code, right? I thought so! Well, I have a secret to tell: I don't always write perfect code. When things don't go as planned, I have to figure out what is going on. To help developers in the dire situations of random application crashes, the ADT provides some valuable tools to help debug your application, including the Dalvik Debug Monitor Server (DDMS) and the Eclipse debugger.

Using the Dalvik Debug Monitor Server

Debugging is rarely fun. Thankfully, the Dalvik Debug Monitor Server (DDMS) provides the tools necessary to help you dig yourself out of a hole of bugs. DDMS is a debugging tool that provides the following features (among others):

  • Port forwarding
  • Screen capture
  • Thread and heap information on the device
  • LogCat (provides dumps of system log messages)
  • Process and radio state information
  • Incoming call and SMS spoofing
  • Location data spoofing

DDMS can work with an emulator and with a connected device. DDMS is located in the Android SDK tools directory. In Chapter 4, you added the tools directory to your path; therefore, you should be able to access DDMS from the command line.

One of the most commonly used features in DDMS is the LogCat viewer, which lets you view the output of system log messages, as shown in Figure 7-10. This system log reports everything from basic information messages, which include the state of the application and device, to warning and error information. When you receive an Application Not Responding ...

Get Android™ Tablet Application Development For Dummies® 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.