Debugging from Eclipse with ADT

If you are developing in Eclipse with the ADT plugin, you can use the built-in Java Debugger, along with DDMS, to debug your applications. To access the debugger and DDMS, Eclipse displays the debugger and DDMS features as perspectives, which are customized Eclipse views that display certain tabs and windows depending on the perspective that you are in. Eclipse also takes care of starting the ADB host daemon for you, so you do not have to run this manually.

The Debug Perspective in Eclipse

The Debug Perspective in Eclipse gives you access to the following tabs:

  • Debug - Displays previously and currently debugged Android applications and its currently running threads
  • Variables - When breakpoints are set, displays variable values during code execution
  • Breakpoints - Displays a list of the set breakpoints in your application code
  • LogCat - Allows you to view system log messages in real time. The LogCat tab is also available in the DDMS perspective.

You can access the Debug Perspective by clicking Window > Open Perspective > Debug. Refer to the appropriate documentation for the Eclipse debugger for more information.

The DDMS Perspective

The DDMS Perspective in Eclipse lets you access all of the features of DDMS from within the Eclipse IDE. The following sections of DDMS are available to you:

  • Devices - Shows the list of devices and AVDs that are connected to ADB.
  • Emulator Control - Lets you carry out device functions.
  • LogCat - Lets you view system log messages in real time.
  • Threads - Shows currently running threads within a VM.
  • Heap - Shows heap usage for a VM.
  • Allocation Tracker - Shows the memory allocation of objects.
  • File Explorer - Lets you explore the device's file system.

To access the DDMS perspective, go to Window > Open Perspective > DDMS. If DDMS does not appear, go to Window > Open Perspective > Other ... and select DDMS from the Open Perspective window that appears. For more information on using DDMS, see Using the Dalvik Debug Monitor Server.