blob: d0af1c554b7ff971c90d67a40e09f540fadf7011 [file] [log] [blame]
Robert Lyce4d2292010-12-16 17:26:11 -08001page.title=Debugging with the Dev Tools App
2@jd:body
3
4<p>The Dev Tools application is installed by default on all system images included with the SDK,
5 so you can use it with the Android Emulator. With the Dev Tools application, you can enable a
6 number of settings on your device that will make it easier to test and debug your applications.</p>
7
8 <p> If you'd like to install the Dev Tools application
9 on a real development device, you can copy the application from your emulator and then install it
10 on your device using ADB. To copy the application from a running emulator, execute:</p>
11 <pre>
12adb -e pull /system/app/Development.apk ./Development.apk
13</pre>
14
15 <p>This copies the .apk file into the current directory. Then install it on your connected device
16 with:</p>
17 <pre>
18adb -d install Development.apk
19</pre>
20
21 <p>To get started, launch the Dev Tools application and select <strong>Development Settings</strong>. This will
22 open the Development Settings page with the following options (among others):</p>
23
24 <dl>
25 <dt><strong>Debug app</strong></dt>
26
27 <dd>
28 Lets you select the application to debug. You do not need to set this to attach a debugger,
29 but setting this value has two effects:
30
31 <ul>
32 <li>It will prevent Android from throwing an error if you pause on a breakpoint for a long
33 time while debugging.</li>
34
35 <li>It will enable you to select the <em>Wait for Debugger</em> option to pause application
36 startup until your debugger attaches (described next).</li>
37 </ul>
38 </dd>
39
40 <dt><strong>Wait for debugger</strong></dt>
41
42 <dd>Blocks the selected application from loading until a debugger attaches. This way you can
43 set a breakpoint in {@link android.app.Activity#onCreate onCreate()},
44 which is important to debug the startup process of an Activity.
45 When you change this option, any currently running instances of the selected application will
46 be killed. In order to check this box, you must have selected a debug application as described
47 in the previous option. You can do the same thing by adding {@link
48 android.os.Debug#waitForDebugger()} to your code.</dd>
49
50 <dt><strong>Show screen updates</strong></dt>
51
52 <dd>Flashes a momentary pink rectangle on any screen sections that are being redrawn. This is
53 very useful for discovering unnecessary screen drawing.</dd>
54
55 <dt><strong>Immediately destroy activities</strong></dt>
56
57 <dd>Tells the system to destroy an activity as soon as it is stopped (as if Android had to
58 reclaim memory).&nbsp; This is very useful for testing the {@link
59 android.app.Activity#onSaveInstanceState} / {@link
60 android.app.Activity#onCreate(android.os.Bundle)} code path, which would otherwise be difficult
61 to force. Choosing this option will probably reveal a number of problems in your application
62 due to not saving state. For more information about saving an application's state, see
63 <a href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a>.</dd>
64
65 <dt><strong>Show CPU usage</strong></dt>
66
67 <dd>Displays CPU meters at the top of the screen, showing how much the CPU is being used. The
68 top red bar shows overall CPU usage, and the green bar underneath it shows the CPU time spent
69 in compositing the screen.
70 <p class="note">Note: You cannot turn this feature off once it is on, without
71 restarting the emulator.</p></dd>
72
73 <dt><strong>Show background</strong></dt>
74
75 <dd>Displays a background pattern when no activity screens are visible. This typically does not
76 happen, but can happen during debugging.</dd>
77 </dl>
78
79 <p>These settings will be remembered across emulator restarts.</p>
80
81
82