| Robert Ly | 044d7ff | 2010-12-29 16:24:24 -0800 | [diff] [blame] | 1 | page.title=Using the Dev Tools App |
| Robert Ly | ce4d229 | 2010-12-16 17:26:11 -0800 | [diff] [blame] | 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> |
| 12 | adb -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> |
| 18 | adb -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). 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 |
| Scott Main | 300cd26 | 2011-02-08 15:04:42 -0800 | [diff] [blame^] | 62 | due to not saving state. For more information about saving an activity's state, see the |
| 63 | <a href="{@docRoot}guide/topics/fundamentals/activities.html#SavingActivityState">Activities</a> |
| 64 | document.</dd> |
| Robert Ly | ce4d229 | 2010-12-16 17:26:11 -0800 | [diff] [blame] | 65 | |
| 66 | <dt><strong>Show CPU usage</strong></dt> |
| 67 | |
| 68 | <dd>Displays CPU meters at the top of the screen, showing how much the CPU is being used. The |
| 69 | top red bar shows overall CPU usage, and the green bar underneath it shows the CPU time spent |
| 70 | in compositing the screen. |
| 71 | <p class="note">Note: You cannot turn this feature off once it is on, without |
| 72 | restarting the emulator.</p></dd> |
| 73 | |
| 74 | <dt><strong>Show background</strong></dt> |
| 75 | |
| 76 | <dd>Displays a background pattern when no activity screens are visible. This typically does not |
| 77 | happen, but can happen during debugging.</dd> |
| 78 | </dl> |
| 79 | |
| 80 | <p>These settings will be remembered across emulator restarts.</p> |
| 81 | |
| 82 | |
| 83 | |