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