Top Debugging Tips

Quick stack dump

To obtain a stack dump from emulator, you can log in with adb shell, use "ps" to find the process you want, and then "kill -3 ". The stack trace appears in the log file.

Displaying useful info on the emulator screen

The device can display useful information such as CPU usage or highlights around redrawn areas. Turn these features on and off in the developer settings window as described in Setting debug and test configurations on the emulator.

Getting system state information from the emulator (dumpstate)

You can access dumpstate information from the Dalvik Debug Monitor Service tool. See dumpsys and dumpstate on the adb topic page.

Getting application state information from the emulator (dumpsys)

You can access dumpsys information from the Dalvik Debug Monitor Service tool. See dumpsys and dumpstate on the adb topic page.

Getting wireless connectivity information

You can get information about wireless connectivity using the Dalvik Debug Monitor Service tool. From the Device menu, select "Dump radio state".

Logging Trace Data

You can log method calls and other tracing data in an activity by calling android.os.Debug.startMethodTracing(). See Running the Traceview Debugging Program for details.

Logging Radio Data

By default, radio information is not logged to the system (it is a lot of data). However, you can enable radio logging using the following commands:

adb shell logcat -b radio

Running adb

Android ships with a tool called adb that provides various capabilities, including moving and syncing files to the emulator, forwarding ports, and running a UNIX shell on the emulator. See Using adb for details.

Getting screen captures from the emulator

Dalvik Debug Monitor Server (DDMS) can capture screenshots from the emulator.

Using debugging helper classes

Android provides debug helper classes such as util.Log and Debug for your convenience.

0 0

Post a comment