Debugging Android Applications Using DDMS

In addition to the normal Debug perspective built into Eclipse for stepping through code and debugging, the ADT plug-in adds the DDMS perspective. While you have the application running, take a quick look at this perspective in Eclipse. You can get to the DDMS perspective (see Figure 1.8) by clicking the Android DDMS icon ( ) in the top-right corner of Eclipse. To switch back to the Eclipse Project Explorer, simply choose the Java perspective from the top-right corner of Eclipse.

If the DDMS perspective is not visible in Eclipse, you can add it to your workspace by clicking the Open Perspective button in the top right next to the available perspectives (or, alternately, choose Window, Open Perspective). To see a complete list of available perspectives, select the Other option from the Open Perspective drop-down menu. Select the DDMS perspective and press OK.

The DDMS perspective can be used to monitor application processes, as well as interact with the emulator. You can simulate voice calls and send SMS messages to the emulator. You can send a mock location fix to the emulator to mimic location-based services. You will learn more about DDMS and the other tools available to Android developers in Hour 2, "Mastering the Android Development Tools."

FIGURE 1.9

The Eclipse dialog for choosing an application deployment target.

The LogCat logging tool is displayed on both the DDMS perspective and the Debug Perspective. This tool displays logging information from the emulator or the handset, if a handset is plugged in.

0 0

Post a comment