Home | History | Annotate | Download | only in debugging
      1 page.title=Using the Dev Tools App
      2 parent.title=Debugging
      3 parent.link=index.html
      4 @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> The Dev Tools application relies on a number of permissions that are not available for
     11   third party applications. If you'd like to install the Dev Tools application
     12   on a real development device, you'd have to build a system image for that device and sign
     13   the Dev Tools application with the same key as used for the system image.</p>
     14 
     15   <p>To get started, launch the Dev Tools application and select <strong>Development Settings</strong>. This will
     16   open the Development Settings page with the following options (among others):</p>
     17 
     18   <dl>
     19     <dt><strong>Debug app</strong></dt>
     20 
     21     <dd>
     22       Lets you select the application to debug. You do not need to set this to attach a debugger,
     23       but setting this value has two effects:
     24 
     25       <ul>
     26         <li>It will prevent Android from throwing an error if you pause on a breakpoint for a long
     27         time while debugging.</li>
     28 
     29         <li>It will enable you to select the <em>Wait for Debugger</em> option to pause application
     30         startup until your debugger attaches (described next).</li>
     31       </ul>
     32     </dd>
     33 
     34     <dt><strong>Wait for debugger</strong></dt>
     35 
     36     <dd>Blocks the selected application from loading until a debugger attaches. This way you can
     37     set a breakpoint in {@link android.app.Activity#onCreate onCreate()}, 
     38     which is important to debug the startup process of an Activity.
     39     When you change this option, any currently running instances of the selected application will
     40     be killed. In order to check this box, you must have selected a debug application as described
     41     in the previous option. You can do the same thing by adding {@link
     42     android.os.Debug#waitForDebugger()} to your code.</dd>
     43 
     44     <dt><strong>Show screen updates</strong></dt>
     45 
     46     <dd>Flashes a momentary pink rectangle on any screen sections that are being redrawn. This is
     47     very useful for discovering unnecessary screen drawing.</dd>
     48 
     49     <dt><strong>Immediately destroy activities</strong></dt>
     50 
     51     <dd>Tells the system to destroy an activity as soon as it is stopped (as if Android had to
     52     reclaim memory).&nbsp; This is very useful for testing the {@link
     53     android.app.Activity#onSaveInstanceState} / {@link
     54     android.app.Activity#onCreate(android.os.Bundle)} code path, which would otherwise be difficult
     55     to force. Choosing this option will probably reveal a number of problems in your application
     56     due to not saving state. For more information about saving an activity's state, see the
     57     <a href="{@docRoot}guide/components/activities.html#SavingActivityState">Activities</a>
     58 document.</dd>
     59 
     60     <dt><strong>Show CPU usage</strong></dt>
     61 
     62     <dd>Displays CPU meters at the top of the screen, showing how much the CPU is being used. The
     63     top red bar shows overall CPU usage, and the green bar underneath it shows the CPU time spent
     64     in compositing the screen. 
     65     <p class="note">Note: You cannot turn this feature off once it is on, without
     66     restarting the emulator.</p></dd>
     67 
     68     <dt><strong>Show background</strong></dt>
     69 
     70     <dd>Displays a background pattern when no activity screens are visible. This typically does not
     71     happen, but can happen during debugging.</dd>
     72   </dl>
     73 
     74   <p>These settings will be remembered across emulator restarts.</p>
     75 
     76 
     77 
     78