page.title=Debugging Tips
@jd:body
While debugging, keep these helpful tips in mind to help you figure out common problems with your
applications:
- Dump the stack trace
- 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.
- Display 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
Debugging with the Dev Tools App.
- Get application and system state information from the emulator
- You can access dumpstate information from the
adb shell
commands. See
dumpsys and
dumpstate on the adb topic page.
- Get wireless connectivity information
- You can get information about wireless connectivity using DDMS.
From the Device menu, select Dump
radio state.
- Log trace data
- You can log method calls and other tracing data in an activity by calling
{@link android.os.Debug#startMethodTracing(String) startMethodTracing()}. See Profiling with Traceview and
dmtracedump for details.
- Log 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
- Capture screenshots
- The Dalvik Debug Monitor Server (DDMS) can capture screenshots from the emulator. Select
Device > Screen capture.
- Use debugging helper classes
- Android provides debug helper classes such as {@link android.util.Log
util.Log} and {@link android.os.Debug} for your convenience.
See the Troubleshooting document
for answers to some common developing and debugging issues.