Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61bfb81f authored by Joe Fernandez's avatar Joe Fernandez Committed by Android (Google) Code Review
Browse files

Merge "docs: Tools docs reorganization, round 1b" into mnc-docs

parents d3d59586 b984c93c
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
page.title=Managing Projects from Android Studio
page.title=Managing Projects with Android Studio

@jd:body

@@ -8,13 +8,6 @@ page.title=Managing Projects from Android Studio

      <ol>
        <li><a href="#CreatingAProject">Creating an Android Project</a></li>
        <ol>
          <li><a href="#Step1CreatingAProject">Create a New Project</a> </li>
          <li><a href="#Step2SelectFormFactor">Select Form Factors and API Level</a> </li>
          <li><a href="#Step3AddActivity">Add an Activity</a> </li>
          <li><a href="#Step4ConfigureActivity">Configure Your App</a> </li>
          <li><a href="#Step5DevelopYourApp">Develop Your App</a> </li>
        </ol>

        <li><a href="#CreatingAModule">Creating an Android Module</a></li>

@@ -359,10 +352,6 @@ Android project view:</p>
per resource type.</li>
</ul>



<h2 id="enable-view">Use the Android Project View</h2>

<p>The <em>Android</em> project view is enabled by default and shows all the build files at
the top level of the project hierarchy under <strong>Gradle Scripts</strong>. The project module
appears as a folder at the top level of the project hierarchy and contains these three elements
@@ -386,12 +375,3 @@ from this representation and maintains the traditional project structure.</p>
&nbsp;&nbsp;&nbsp;
<img src="{@docRoot}images/tools/projectview-p2.png" alt="" style="width:240px" " />
<p class="img-caption"><strong>Figure 10:</strong> Android and Traditional project view </p>








+0 −77
Original line number Diff line number Diff line
page.title=Using the Dev Tools App
parent.title=Debugging
parent.link=index.html
@jd:body

<p>The Dev Tools application is installed by default on all system images included with the SDK,
  so you can use it with the Android Emulator. With the Dev Tools application, you can enable a
  number of settings on your device that will make it easier to test and debug your applications.</p>

  <p> The Dev Tools application relies on a number of permissions that are not available for
  third party applications. If you'd like to install the Dev Tools application
  on a real development device, you'd have to build a system image for that device and sign
  the Dev Tools application with the same key as used for the system image.</p>

  <p>To get started, launch the Dev Tools application and select <strong>Development Settings</strong>. This will
  open the Development Settings page with the following options (among others):</p>

  <dl>
    <dt><strong>Debug app</strong></dt>

    <dd>
      Lets you select the application to debug. You do not need to set this to attach a debugger,
      but setting this value has two effects:

      <ul>
        <li>It will prevent Android from throwing an error if you pause on a breakpoint for a long
        time while debugging.</li>

        <li>It will enable you to select the <em>Wait for Debugger</em> option to pause application
        startup until your debugger attaches (described next).</li>
      </ul>
    </dd>

    <dt><strong>Wait for debugger</strong></dt>

    <dd>Blocks the selected application from loading until a debugger attaches. This way you can
    set a breakpoint in {@link android.app.Activity#onCreate onCreate()}, 
    which is important to debug the startup process of an Activity.
    When you change this option, any currently running instances of the selected application will
    be killed. In order to check this box, you must have selected a debug application as described
    in the previous option. You can do the same thing by adding {@link
    android.os.Debug#waitForDebugger()} to your code.</dd>

    <dt><strong>Show screen updates</strong></dt>

    <dd>Flashes a momentary pink rectangle on any screen sections that are being redrawn. This is
    very useful for discovering unnecessary screen drawing.</dd>

    <dt><strong>Immediately destroy activities</strong></dt>

    <dd>Tells the system to destroy an activity as soon as it is stopped (as if Android had to
    reclaim memory).&nbsp; This is very useful for testing the {@link
    android.app.Activity#onSaveInstanceState} / {@link
    android.app.Activity#onCreate(android.os.Bundle)} code path, which would otherwise be difficult
    to force. Choosing this option will probably reveal a number of problems in your application
    due to not saving state. For more information about saving an activity's state, see the
    <a href="{@docRoot}guide/components/activities.html#SavingActivityState">Activities</a>
document.</dd>

    <dt><strong>Show CPU usage</strong></dt>

    <dd>Displays CPU meters at the top of the screen, showing how much the CPU is being used. The
    top red bar shows overall CPU usage, and the green bar underneath it shows the CPU time spent
    in compositing the screen. 
    <p class="note">Note: You cannot turn this feature off once it is on, without
    restarting the emulator.</p></dd>

    <dt><strong>Show background</strong></dt>

    <dd>Displays a background pattern when no activity screens are visible. This typically does not
    happen, but can happen during debugging.</dd>
  </dl>

  <p>These settings will be remembered across emulator restarts.</p>


+34 −35
Original line number Diff line number Diff line
page.title=Reading and Writing Logs
parent.title=Debugging
parent.link=index.html

@jd:body

<div id="qv-wrapper">
@@ -8,8 +7,6 @@ parent.link=index.html
      <h2>In this document</h2>

      <ol>
        <li><a href="#logClass">The Log class</a></li>

        <li><a href="#startingLogcat">Starting LogCat</a></li>

        <li><a href="#filteringOutput">Filtering Log Output</a></li>
@@ -20,7 +17,7 @@ parent.link=index.html

        <li><a href="#viewingStd">Viewing stdout and stderr</a></li>

        <li><a href="#DebuggingWebPages">Debugging Web Pages</a></li>
        <li><a href="#logClass">Logging from Code</a></li>
      </ol>
    </div>
  </div>
@@ -31,31 +28,6 @@ parent.link=index.html
  {@link android.util.Log} class. You can run LogCat through ADB or from DDMS, which allows you to
  read the messages in real time.</p>

  <h2 id="logClass">The <code>Log</code> class</h2>

  <p>{@link android.util.Log} is a logging class that you can utilize in your code to print out
  messages to the LogCat. Common logging methods include:</p>

  <ul>
    <li>{@link android.util.Log#v(String,String)} (verbose)</li>

    <li>{@link android.util.Log#d(String,String)} (debug)</li>

    <li>{@link android.util.Log#i(String,String)} (information)</li>

    <li>{@link android.util.Log#w(String,String)} (warning)</li>

    <li>{@link android.util.Log#e(String,String)} (error)</li>
  </ul>For example:
  <pre class="no-pretty-print">
Log.i("MyActivity", "MyClass.getView() &mdash; get item number " + position);
</pre>

  <p>The LogCat will then output something like:</p>
  <pre class="no-pretty-print">
I/MyActivity( 1557): MyClass.getView() &mdash; get item number 1
</pre>

  <h2 id="startingLogcat">Using LogCat</h2>

  <p>You can use LogCat from within DDMS or call it on an ADB shell. For more information on how to
@@ -301,8 +273,35 @@ $ adb shell start
  setting as a default on the emulator/device instance, you can add an entry to
  <code>/data/local.prop</code> on the device.</p>

  <h2 id="DebuggingWebPages">Debugging Web Apps</h2>
  <p>
  If you're developing a web application for Android, you can debug your JavaScript using the console JavaScript APIs,
  which output messages to LogCat. For more information, see
  <a href="{@docRoot}guide/webapps/debugging.html">Debugging Web Apps</a>.</p>
  <h2 id="logClass">Logging from Code</h2>

  <p>The {@link android.util.Log} class allows you to create log entries in your code that display
  in the LogCat tool. Common logging methods include:</p>

  <ul>
    <li>{@link android.util.Log#v(java.lang.String, java.lang.String)
      Log.v(String, String)} (verbose)</li>

    <li>{@link android.util.Log#d(java.lang.String, java.lang.String)
      Log.d(String, String)} (debug)</li>

    <li>{@link android.util.Log#i(java.lang.String, java.lang.String)
      Log.i(String, String)} (information)</li>

    <li>{@link android.util.Log#w(java.lang.String, java.lang.String)
      Log.w(String, String)} (warning)</li>

    <li>{@link android.util.Log#e(java.lang.String, java.lang.String)
      Log.e(String, String)} (error)</li>
  </ul>

  <p>For example, using the following call:</p>

  <pre class="no-pretty-print">
Log.i("MyActivity", "MyClass.getView() &mdash; get item number " + position);
</pre>

  <p>The LogCat outputs something like:</p>
  <pre class="no-pretty-print">
I/MyActivity( 1557): MyClass.getView() &mdash; get item number 1
</pre>
+0 −78
Original line number Diff line number Diff line
page.title=Debugging from Other IDEs
parent.title=Debugging
parent.link=index.html
@jd:body


 <div id="qv-wrapper">
    <div id="qv">
      <h2>In this document</h2>

      <ol>
        <li><a href="#start-debugging">Starting a Debugging Environment</a>
        <ul>
          <li><a href="#debuggingPort">Configuring Your IDE to Attach to the Debugging Port</a></li>
        </ul>
        </li>
      </ol>
    </div>
  </div>
 
  <p>If you are not using Android Studio to develop, you can still take advantage of all the tools that
  the Android SDK provides for debugging. A basic debugging environment consists of:</p>

  <ul>
    <li><a href="{@docRoot}tools/help/adb.html">ADB</a></li>

    <li><a href="{@docRoot}tools/debugging/ddms.html">DDMS</a></li>

    <li>Java Debugger</li>
  </ul>
  
  <p>You need to obtain a JDWP-compliant Java debugger to properly debug your application.
  Most Java IDEs will already have one included, or you can use a command line debugger,
  such as JDB, if you are using a simple text editor to develop applications.</p>

  <h2 id="start-debugging">Starting a debugging environment</h2>
  <p>A Java Debugger assists you in finding problems with
  your code by letting you set breakpoints, step through execution of your application, and examine
  variable values. Since you are not using Android Studio, you have to manually start up the debugging
  environment yourself by running a few tools that are provided in the Android SDK. To begin
  debugging your application, follow these general steps:</p>

  <ol>
    <li>Load an AVD with the Android emulator or connect a device to your computer.</li>
    
    <li>Start DDMS from the sdk <code>/tools</code> directory. This also starts ADB if it is 
    not already started. You should see your device appear in DDMS.</li>

    <li>Install and run your <code>.apk</code> file on the device or emulator. In DDMS, you should
    see your application running under the device that you installed it to.</li>

    <li>Attach your debugger to the debugging port 8700, or to the specific port shown for the
    application in DDMS.</li>
  </ol>

  <h3 id="debuggingPort">Configuring Your IDE to Attach to the Debugging Port</h3>

  <p>DDMS assigns a specific debugging port to every virtual machine that it finds on the
  emulator. You must either attach your IDE to that port (listed on the Info tab for that VM), or
  you can use a default port 8700 to connect to whatever application is currently selected on the
  list of discovered virtual machines.</p>

  <p>Your IDE should attach to your application running on the emulator, showing you its threads
  and allowing you to suspend them, inspect their state, and set breakpoints. If you selected "Wait
  for debugger" in the Development settings panel the application will run when Android Studio connects,
  so you will need to set any breakpoints you want before connecting.</p>

  <p>Changing either the application being debugged or the "Wait for debugger" option causes the
  system to kill the selected application if it is currently running. You can use this to kill your
  application if it is in a bad state by simply going to the settings and toggling the
  checkbox.</p>






+7 −23
Original line number Diff line number Diff line
@@ -43,10 +43,6 @@ avd</code>) the emulator (<code>emulator</code>), and the Dalvik Debug Monitor S
  <dt><a href="{@docRoot}tools/help/android.html">android</a></dt>
    <dd>Lets you manage AVDs, projects, and the installed components of the SDK.</dd>

  <dt><a href="{@docRoot}tools/help/app-link-indexing.html">Deep Link and App Indexing API Support</a></dt>
    <dd>Helps you add deep links, app indexing, and search functionality to your apps.
  These features can make it easier to find content in an installed app, drive more traffic to your
  app, discover which app content is used most, and attract new users.</dd>

  <dt><a href="{@docRoot}tools/help/hierarchy-viewer.html">Hierarchy Viewer (hierarchyviewer)</a></dt>
    <dd>Provides a visual representation of the layout's View hierarchy with performance information
@@ -63,8 +59,6 @@ avd</code>) the emulator (<code>emulator</code>), and the Dalvik Debug Monitor S
  <dt><a href="{@docRoot}tools/help/sqlite3.html">sqlite3</a></dt>
    <dd>Lets you access the SQLite data files created and used by Android applications.</dd>

  <dt><a href="{@docRoot}tools/help/translations-editor.html">Translations Editor</a></dt>
    <dd>Lets you view and update all your string resource translations in one convenient place.</dd>

</dl>

@@ -85,9 +79,8 @@ avd</code>) the emulator (<code>emulator</code>), and the Dalvik Debug Monitor S
  <dt><a href="{@docRoot}tools/help/shell.html">ADB Shell Commands</a></dt>
    <dd>Learn the commands available for advanced command-line operations.</dd>

  <dt><a href="{@docRoot}tools/debugging/ddms.html">Dalvik Debug Monitor
Server (ddms)</a></dt>
    <dd>Lets you debug Android applications.</dd>
  <dt><a href="{@docRoot}tools/debugging/ddms.html">Dalvik Debug Monitor Server (ddms)</a></dt>
    <dd>Lets you debug Android apps.</dd>

  <dt><a href="{@docRoot}tools/help/monitor.html">Device Monitor</a></dt>
    <dd>Android Device Monitor is a stand-alone tool that provides a graphical user interface for
@@ -112,6 +105,11 @@ you can view the file in a profiling tool of your choice.</dd>
  <dt><a href="{@docRoot}tools/help/traceview.html">traceview</a></dt>
    <dd>Provides a graphical viewer for execution logs saved by your application.</dd>

  <dt><a href="{@docRoot}tools/help/gltracer.html">Tracer for OpenGL ES</a></dt>
    <dd>Allows you to capture <a href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL ES</a>
      commands and frame-by-frame images to help you understand how your app is executing
      graphics commands.</dd>

</dl>


@@ -142,24 +140,10 @@ files after they have been signed.</dd>
WYSIWYG editor. It also previews stretched versions of the image, and highlights the area in which
content is allowed.</dd>

<dt><a href="{@docRoot}tools/help/image-asset-studio.html">Image Asset Studio</a></dt>
    <dd>Helps you to generate custom icons for your Android applications from existing images, cliparts, or text.
     It generates a set of icons at the appropriate resolution for each generalized screen density that your app
     supports.</dd>

<dt><a href="{@docRoot}tools/help/vector-asset-studio.html">Vector Asset Studio</a></dt>

    <dd>Helps you add material icons and import Scalable Vector Graphic (SVG) files into your
    Android Studio project as a drawable resource.</dd>

  <dt><a href="{@docRoot}tools/help/etc1tool.html">etc1tool</a></dt>
    <dd>A command line utility that lets you encode PNG images to the ETC1 compression standard and
    decode ETC1 compressed images back to PNG.</dd>

  <dt><a href="{@docRoot}tools/help/gltracer.html">Tracer for OpenGL ES</a></dt>
    <dd>Allows you to capture OpenGL ES commands and frame by frame images to help you understand
    how your graphics commands are being executed.</dd>

</dl>


Loading