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

Commit ee2dacd1 authored by Robert Ly's avatar Robert Ly
Browse files

Doc change: restructuring of developing topics. Includes Overview, Creating...

Doc change: restructuring of developing topics. Includes Overview, Creating and Managing AVDs, and Connecting HW Devices

Change-Id: I9e96d075c7a987d4e870671f23f420f72e9b5527
parent a97ec8dc
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -15,10 +15,6 @@ page.title=Developing on a Device
  <ol>
    <li><a
    href="{@docRoot}sdk/win-usb.html">USB Driver for Windows</a></li>
    <li><a
href="{@docRoot}guide/developing/eclipse-adt.html">Developing in Eclipse, with ADT</a></li>
    <li><a
href="{@docRoot}guide/developing/other-ide.html">Developing in other IDEs</a></li>
  </ol>
</div>
</div>
@@ -30,10 +26,7 @@ environment and Android-powered device for testing and debugging on the device.<
<p>You can use any Android-powered device as an environment for running,
debugging, and testing your applications. The tools included in the SDK make it easy to install and
run your application on the device each time you compile. You can install your application on the
device <a
href="{@docRoot}guide/developing/eclipse-adt.html#RunningOnDevice">directly from
Eclipse</a> or <a href="{@docRoot}guide/developing/other-ide.html#RunningOnDevice">from the
command line</a>. If
device directly from Eclipse or from the command line with ADB. If
you don't yet have a device, check with the service providers in your area to determine which
Android-powered devices are available.</p>

+1773 −0

File added.

Preview size limit exceeded, changes collapsed.

+78 −0
Original line number Diff line number Diff line
page.title=Creating and Managing Virtual Devices
@jd:body


 <p>An Android Virtual Device (AVD) is an emulator configuration that lets you model an actual
  device by defining hardware and software options to be emulated by the Android Emulator.</p>

  <p>The easiest way to create an AVD is to use the graphical <a href= 
  "{@docRoot}guide/developing/devices/managing-avds.html">AVD Manager</a>, which you launch
  from Eclipse by clicking <strong>Window &gt; Android SDK and AVD Manager</strong>. You can also start
  the AVD Manager from the command line by calling the <code>android</code> tool in the <strong>tools</strong>
  directory of the Android SDK.</p>

  <p>You can also create AVDs on the command line by passing the <code>android</code> tool options.
  For more information on how to create AVDs in this manner, see <a href= 
  "{@docRoot}guide/developing/devices/managing-avds-cmdline.html">Creating and Managing Virtual
  Devices on the Command Line</a>.</p>

  <p>An AVD consists of:</p>

  <ul>
    <li>A hardware profile: Defines the hardware features of the virtual
    device. For example, you can define whether the device has a camera, whether it uses a physical
    QWERTY keyboard or a dialing pad, how much memory it has, and so on.</li>

    <li>A mapping to a system image: You can define what version of the Android platform will run
    on the virtual device. You can choose a version of the standard Android platform or the system
    image packaged with an SDK add-on.</li>

    <li>Other options: You can specify the emulator skin you want to use with the AVD, which lets
    you control the screen dimensions, appearance, and so on. You can also specify the emulated SD
    card to use with the AVD.</li>

    <li>A dedicated storage area on your development machine: the device's user data (installed
    applications, settings, and so on) and emulated SD card are stored in this area.</li>
  </ul>

  <p>You can create as many AVDs as you need, based on the types of device you want to model. 
  To thoroughly test your application, you should create an AVD for each general device configuration
  (for example, different screen sizes and platform versions) with which your application is compatible
  and test your application on each one.</p>

  <p>Keep these points in mind when you are selecting a system image target for your AVD:</p>

  <ul>
    <li>The API Level of the target is important, because your application will not be able to run
    on a system image whose API Level is less than that required by your application, as specified
    in the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">
    <code>minSdkVersion</code></a> attribute of the application's manifest file. For more
    information about the relationship between system API Level and application
    <code>minSdkVersion</code>, see <a href=
    "{@docRoot}guide/publishing/versioning.html">Specifying Minimum System API Version</a>.</li>

    <li>You should create at least one AVD that uses a target whose API Level is greater than that required
    by your application, because it allows you to test the
    forward-compatibility of your application. Forward-compatibility testing ensures that, when
    users who have downloaded your application receive a system update, your application will
    continue to function normally.</li>

    <li>If your application declares a 
    <a href="{@docRoot}guide/topics/manifest/uses-library-element.html"><code>uses-library</code></a>
    element in its manifest file, the application can only run on a system image in which that external
    library is present. If you want to run your application on an emulator, create an AVD that
    includes the required library. Usually, you must create such an AVD using an Add-on component for the
    AVD's platform (for example, the Google APIs Add-on contains the Google Maps library).</li>
  </ul>

  <p>To learn how to manage AVDs using a graphical tool, read <a href=
  "{@docRoot}guide/developing/devices/managing-avds.html">
  Creating and Managing AVDs with AVD Manager</a>. To learn how to manage AVDs on the command line, read
  <a href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">Creating and Managing AVDs
  on the Command Line</a>.</p>





+312 −0
Original line number Diff line number Diff line
page.title=Creating and Managing AVDs on the Command Line
@jd:body

<div id="qv-wrapper">
  <div id="qv">
  <h2>In this document</h2>
  <ol>
    <li><a href="#listingtargets">Listing targets</a></li>
    <li><a href="#AVDCmdLine">Creating AVDs</a></li>
    <li><a href="#moving">Moving an AVD</a></li>
    <li><a href="#updating">Updating an AVD</a></li>
    <li><a href="#deleting">Deleting an AVD</a></li>
  </ol>
  </div>
</div>


<p>The <code>android</code> tool lets you manage AVDs on the command line. For a complete reference 
of the command line options that you can use, see the reference for the 
<a href="{@docRoot}guide/developing/tools/android.html"><code>android</code></a> tool.</p>



<h2 id="listingtargets">Listing targets</h2>

<p>To generate a list of system image targets, use this command: </p>

<pre>android list targets</pre>

<p>The <code>android</code> tool scans the <code>&lt;sdk&gt;/platforms/</code> and
<code>&lt;sdk&gt;/add-ons/</code> directories looking for valid system images and
then generates the list of targets. Here's an example of the command output:
</p>

<pre>Available Android targets:
id: 1 or "android-3"
     Name: Android 1.5
     Type: Platform
     API level: 3
     Revision: 4
     Skins: QVGA-L, HVGA-L, HVGA (default), HVGA-P, QVGA-P
id: 2 or "android-4"
     Name: Android 1.6
     Type: Platform
     API level: 4
     Revision: 3
     Skins: QVGA, HVGA (default), WVGA800, WVGA854
id: 3 or "android-7"
     Name: Android 2.1-update1
     Type: Platform
     API level: 7
     Revision: 2
     Skins: QVGA, WQVGA400, HVGA (default), WVGA854, WQVGA432, WVGA800
id: 4 or "android-8"
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 2
     Skins: WQVGA400, QVGA, WVGA854, HVGA (default), WVGA800, WQVGA432
id: 5 or "android-9"
     Name: Android 2.3
     Type: Platform
     API level: 9
     Revision: 1
     Skins: HVGA (default), WVGA800, WQVGA432, QVGA, WVGA854, WQVGA400
</pre>

<h2 id="AVDCmdLine">Creating AVDs</h2> 
<p>In addition to creating AVDs with the 
<a href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">AVD Manager user interface</a>,
you can also create them by passing in command line arguments to the <code>android</code> tool.
</p>

<p>Open a terminal window and change to
the <code>&lt;sdk&gt;/tools/</code> directory, if needed.</p>

<p>To create each AVD, you issue the command <code>android create avd</code>,
with options that specify a name for the new AVD and the system image you want
to run on the emulator when the AVD is invoked. You can specify other options on
the command line also, such as the emulated SD card size, the emulator skin, or a custom
location for the user data files.</p> 

<p>Here's the command-line usage for creating an AVD: </p>

<pre>android create avd -n &lt;name&gt; -t &lt;targetID&gt; [-&lt;option&gt; &lt;value&gt;] ... </pre>

<p>You can use any name you want for the AVD, but since you are likely to be
creating multiple AVDs, you should choose a name that lets you recognize the
general characteristics offered by the AVD. The target ID is an integer assigned by the
<code>android</code> tool. The target ID is not derived from the system image name, 
version, or API Level, or other attribute, so you need to run the <code>android list targets</code>
command to list the target ID of each system image. You should do this <em>before</em> you run
the <code>android create avd</code> command. See the <a href="{@docRoot}guide/developing/tools/android.html">android</a></p>
tool documentation for more information on the command line options.  


<p>When you've selected the target you want to use and made a note of its ID,
use the <code>android create avd</code> command to create the AVD, supplying the
target ID as the <code>-t</code> argument. Here's an example that creates an
AVD with name "my_android1.5" and target ID "2" (the standard Android 1.5 
system image in the list above): </p>

<pre>android create avd -n my_android1.5 -t 2</pre>

<p>If the target you selected was a standard Android system image ("Type:
platform"), the <code>android</code> tool next asks you whether you want to
create a custom hardware profile. </p>
<pre>Android 1.5 is a basic Android platform.
Do you wish to create a custom hardware profile [no]</pre>

<p>If you want to set custom hardware emulation options for the AVD, enter
"yes" and set values as needed. If you want to use the default hardware
emulation options for the AVD, just press the return key (the default is "no").
The <code>android</code> tool creates the AVD with name and system image mapping you
requested, with the options you specified. For more information, see <a href="#hardwareopts">
Setting Hardware Emulation Options</a>.

<p class="note"><strong>Note:</strong> If you are creating an AVD whose target is an SDK add-on, the
<code>android</code> tool does not allow you to set hardware emulation options.
It assumes that the provider of the add-on has set emulation options
appropriately for the device that the add-on is modeling, and so prevents you
from resetting the options. </p>


<h3>Default location of AVD files</h3>
<p>When you create an AVD, the <code>android</code> tool creates a dedicated directory for it
on your development computer. The directory contains the AVD configuration file,
the user data image and SD card image (if available), and any other files
associated with the device. Note that the directory does not contain a system
image &mdash; instead, the AVD configuration file contains a mapping to the
system image, which it loads when the AVD is launched. </p>

<p>The <code>android</code> tool also creates an <code>&lt;AVD_name&gt;.ini</code> file for the AVD at the
root of the <code>.android/avd/</code> directory on your computer. The file specifies the
location of the AVD directory and always remains at the root the .android 
directory.</p>

<p>By default, the <code>android</code> tool creates the AVD directory inside
<code>~/.android/avd/</code> (on Linux/Mac), <code>C:\Documents and
Settings\&lt;user&gt;\.android\</code> on Windows XP, and 
<code>C:\Users\&lt;user&gt;\.android\</code> on Windows 7 and Vista. 
If you want to use a custom location for the AVD directory, you 
can do so by using the <code>-p &lt;path&gt;</code> option when 
you create the AVD: </p>

<pre>android create avd -n my_android1.5 -t 2 -p path/to/my/avd</pre>

<p>If the .android directory is hosted on a network drive, we recommend using
the <code>-p</code> option to place the AVD directory in another location. 
The  AVD's .ini file remains in the .android directory on the network
drive, regardless of the location of the AVD directory. 


<h3 id="hardwareopts">Setting Hardware Emulation Options</h3>

<p>When you are creating a new AVD that uses a standard Android system image ("Type:
platform"), the <code>android</code> tool lets you set hardware emulation
options for virtual device. The table below lists the options available and the
default values, as well as the names of properties that store the emulated
hardware options in the AVD's configuration file (the config.ini file in the
AVD's local directory). </p>

<p class="table-caption"><strong>Table 1.</strong> Available hardware profile options for AVDs and
the default values </p>

<table>
<tr>
<th>Characteristic</th>
<th>Description</th>
<th>Property</th>
</tr>

<tr>
<td>Device ram size</td>
<td>The amount of physical RAM on the device, in megabytes. Default value is "96".
<td>hw.ramSize</td>
</tr>

<tr>
<td>Touch-screen support</td>
<td>Whether there is a touch screen or not on the device. Default value is "yes".</td>
<td>hw.touchScreen

<tr>
<td>Trackball support </td>
<td>Whether there is a trackball on the device. Default value is "yes".</td>
<td>hw.trackBall</td>
</tr>

<tr>
<td>Keyboard support</td>
<td>Whether the device has a QWERTY keyboard. Default value is "yes".</td>
<td>hw.keyboard</td>
</tr>

<tr>
<td>DPad support</td>
<td>Whether the device has DPad keys. Default value is "yes".</td>
<td>hw.dPad</td>
</tr>

<tr>
<td>GSM modem support</td>
<td>Whether there is a GSM modem in the device. Default value is "yes".</td>
<td>hw.gsmModem</td>
</tr>

<tr>
<td>Camera support</td>
<td>Whether the device has a camera. Default value is "no".</td>
<td>hw.camera</td>
</tr>

<tr>
<td>Maximum horizontal camera pixels</td>
<td>Default value is "640".</td>
<td>hw.camera.maxHorizontalPixels</td>
</tr>

<tr>
<td>Maximum vertical camera pixels</td>
<td>Default value is "480".</td>
<td>hw.camera.maxVerticalPixels</td>
</tr>

<tr>
<td>GPS support</td>
<td>Whether there is a GPS in the device. Default value is "yes".</td>
<td>hw.gps</td>
</tr>

<tr>
<td>Battery support</td>
<td>Whether the device can run on a battery. Default value is "yes".</td>
<td>hw.battery</td>
</tr>

<tr>
<td>Accelerometer</td>
<td>Whether there is an accelerometer in the device. Default value is "yes".</td>
<td>hw.accelerometer</td>
</tr>

<tr>
<td>Audio recording support</td>
<td>Whether the device can record audio. Default value is "yes".</td>
<td>hw.audioInput</td>
</tr>

<tr>
<td>Audio playback support</td>
<td>Whether the device can play audio. Default value is "yes".</td>
<td>hw.audioOutput</td>
</tr>

<tr>
<td>SD Card support</td>
<td>Whether the device supports insertion/removal of virtual SD Cards. Default value is "yes".</td>
<td>hw.sdCard</td>
</tr>

<tr>
<td>Cache partition support</td>
<td>Whether we use a /cache partition on the device. Default value is "yes".</td>
<td>disk.cachePartition</td>
</tr>

<tr>
<td>Cache partition size</td>
<td>Default value is "66MB".</td>
<td>disk.cachePartition.size </td>
</tr>

<tr>
<td>Abstracted LCD density</td>
<td>Sets the generalized density characteristic used by the AVD's screen. Default value is "160".</td>
<td>hw.lcd.density </td>
</tr>

<tr>
<td>Trackball support</td>
<td>Whether there is a trackball present.</td>
<td>hw.trackBall </td>
</tr>
</table>


<h2 id="moving">Moving an AVD</h2>

<p>If you want to move or rename an AVD, you can do so using this command:</p>

<pre>android move avd -n &lt;name&gt; [-&lt;option&gt; &lt;value&gt;] ...</pre>

<h2 id="updating">Updating an AVD</h2>

<p>If, for any reason, the platform/add-on root folder has its name changed (maybe because the user has installed an update of the platform/add-on) then the AVD will not be able to load the system image that it is mapped to. In this case, the <code>android list targets</code> command will produce this output: 

<pre>The following Android Virtual Devices could not be loaded: 
Name: foo 
Path: &lt;path&gt;/.android/avd/foo.avd 
Error: Invalid value in image.sysdir. Run 'android update avd -n foo' </pre>

<p>To fix this error, use the <code>android update avd</code> command to recompute the path to the system images.</p>

<h2 id="deleting">Deleting an AVD</h2>

<p>You can use the <code>android</code> tool to delete an AVD. Here is the command usage:</p>

<pre>android delete avd -n &lt;name&gt; </pre>

<p>When you issue the command, the <code>android</code> tool looks for an AVD matching the 
specified name deletes the AVD's directory and files. </p>
+239 −0
Original line number Diff line number Diff line
page.title=Creating and Managing AVDs with AVD Manager
@jd:body

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

      <ol>
        <li><a href="#AVDEclipse">Creating an AVD</a></li>
      </ol>
    </div>
  </div>

  <p>The AVD Manager is an easy to use user interface to manage your AVD (Android Virtual Device)
  configurations. An AVD is a device configuration for the Android emulator that allows you to
  model different configurations of Android-powered devices. When you start the AVD Manager in Eclipse 
  or run the <code>android</code> tool on the command line, you will see the AVD Manager as shown in
  figure 1:</p>
  
  <img src="{@docRoot}images/avd-manager.png">
  
  <p class="img-caption"><strong>Figure 1. </strong>Screenshot of the AVD Manager. </p>
  
  <p>From the main screen, you can create, delete, repair and start AVDs as well as see the details
  of each AVD. </p>

  
  <h2>Creating an AVD</h2>

  <p>You can create as many AVDs as you would like to test on. It is recommended that you test your
  applications on all API levels higher than the target API level for your application.</p>

  <p>To create an AVD:</p>

  <ol>
    <li>Start the AVD Manager:

      <ul>
        <li>In Eclipse: select <strong>Window &gt; Android SDK and AVD Manager</strong>, or click
        the Android SDK and AVD Manager icon in the Eclipse toolbar.</li>

        <li>In other IDEs: Navigate to your SDK's <code>tools/</code> directory and execute the
        <code>android</code> tool with no arguments.</li>
      </ul>
    </li>

    <li><p>In the <em>Virtual Devices</em> panel, you'll see a list of existing AVDs. Click
    <strong>New</strong> to create a new AVD. The <strong>Create New AVD</strong> dialog appears.</p>
      
      <img src="{@docRoot}images/developing/avd-dialog.png" alt="AVD Dialog">
      <p class="img-caption"><strong>Figure 2.</strong> Screenshot of the Create AVD window</p>
    </li>

    <li>Fill in the details for the AVD.

      <p>Give it a name, a platform target, an SD card size, and a skin (HVGA is default). You can
      also add specific hardware features of the emulated device by clicking the
      <strong>New...</strong> button and selecting the feature. For a list of hardware features,
      see <a href="#hardwareopts">Hardware options</a>.</p>

      <p class="note"><strong>Note:</strong> Be sure to define a target for your AVD that satisfies
      your application's Build Target (the AVD platform target must have an API Level equal to or
      greater than the API Level that your application compiles against).</p>
    </li>

    <li>Click <strong>Create AVD</strong>.</li>
  </ol>

  <p>Your AVD is now ready and you can either close the SDK and AVD Manager, create more AVDs, or
  launch an emulator with the AVD by selecting a device and clicking <strong>Start</strong>.</p>

<h3 id="hardwareopts">Hardware options</h3>
<p>If you are creating a new AVD, you can specify the following hardware options for the AVD
to emulate:</p>

  <table>
    <tr>
      <th>Characteristic</th>

      <th>Description</th>

      <th>Property</th>
    </tr>

    <tr>
      <td>Device ram size</td>

      <td>The amount of physical RAM on the device, in megabytes. Default value is "96".</td>

      <td>hw.ramSize</td>
    </tr>

    <tr>
      <td>Touch-screen support</td>

      <td>Whether there is a touch screen or not on the device. Default value is "yes".</td>

      <td>hw.touchScreen</td>
    </tr>

    <tr>
      <td>Trackball support</td>

      <td>Whether there is a trackball on the device. Default value is "yes".</td>

      <td>hw.trackBall</td>
    </tr>

    <tr>
      <td>Keyboard support</td>

      <td>Whether the device has a QWERTY keyboard. Default value is "yes".</td>

      <td>hw.keyboard</td>
    </tr>

    <tr>
      <td>DPad support</td>

      <td>Whether the device has DPad keys. Default value is "yes".</td>

      <td>hw.dPad</td>
    </tr>

    <tr>
      <td>GSM modem support</td>

      <td>Whether there is a GSM modem in the device. Default value is "yes".</td>

      <td>hw.gsmModem</td>
    </tr>

    <tr>
      <td>Camera support</td>

      <td>Whether the device has a camera. Default value is "no".</td>

      <td>hw.camera</td>
    </tr>

    <tr>
      <td>Maximum horizontal camera pixels</td>

      <td>Default value is "640".</td>

      <td>hw.camera.maxHorizontalPixels</td>
    </tr>

    <tr>
      <td>Maximum vertical camera pixels</td>

      <td>Default value is "480".</td>

      <td>hw.camera.maxVerticalPixels</td>
    </tr>

    <tr>
      <td>GPS support</td>

      <td>Whether there is a GPS in the device. Default value is "yes".</td>

      <td>hw.gps</td>
    </tr>

    <tr>
      <td>Battery support</td>

      <td>Whether the device can run on a battery. Default value is "yes".</td>

      <td>hw.battery</td>
    </tr>

    <tr>
      <td>Accelerometer</td>

      <td>Whether there is an accelerometer in the device. Default value is "yes".</td>

      <td>hw.accelerometer</td>
    </tr>

    <tr>
      <td>Audio recording support</td>

      <td>Whether the device can record audio. Default value is "yes".</td>

      <td>hw.audioInput</td>
    </tr>

    <tr>
      <td>Audio playback support</td>

      <td>Whether the device can play audio. Default value is "yes".</td>

      <td>hw.audioOutput</td>
    </tr>

    <tr>
      <td>SD Card support</td>

      <td>Whether the device supports insertion/removal of virtual SD Cards. Default value is
      "yes".</td>

      <td>hw.sdCard</td>
    </tr>

    <tr>
      <td>Cache partition support</td>

      <td>Whether we use a /cache partition on the device. Default value is "yes".</td>

      <td>disk.cachePartition</td>
    </tr>

    <tr>
      <td>Cache partition size</td>

      <td>Default value is "66MB".</td>

      <td>disk.cachePartition.size</td>
    </tr>

    <tr>
      <td>Abstracted LCD density</td>

      <td>Sets the generalized density characteristic used by the AVD's screen. Default value is
      "160".</td>

      <td>hw.lcd.density</td>
    </tr>

    <tr>
      <td>Trackball support</td>

      <td>Whether there is a trackball present.</td>

      <td>hw.trackBall</td>
    </tr>
  </table>
Loading