Home | History | Annotate | Download | only in tools
      1 page.title=Android Virtual Devices
      2 @jd:body
      3 
      4 <div id="qv-wrapper">
      5 <div id="qv">
      6 
      7   <h2>AVD quickview</h2>
      8   <ul>
      9     <li>You need to create an AVD to run any app in the Android emulator</li>
     10     <li>Each AVD is a completely independent virtual device, with its own
     11         hardware options, system image, and data storage.
     12     <li>You create AVD configurations to model different device environments 
     13         in the Android emulator.</li>
     14     <li>You can launch a graphical Android AVD Manager either through Eclipse or
     15 through the <code>android</code> tool. The <code>android</code> tool also offers
     16 a command-line interface for creating and managing AVDs.</li> </ul>
     17   <h2>In this document</h2>
     18   <ol>
     19     <li><a href="#creating">Creating an AVD</a>
     20       <ol>
     21         <li><a href="#hardwareopts">Setting hardware emulation options</a></li>
     22         <li><a href="#location">Default location of the AVD files</a></li>
     23       </ol>
     24     </li>
     25     <li><a href="#managing">Managing AVDs</a>
     26       <ol>
     27         <li><a href="#moving">Moving an AVD</a></li>
     28         <li><a href="#updating">Updating an AVD</a></li>
     29         <li><a href="#deleting">Deleting an AVD</a></li>
     30       </ol>
     31     </li>
     32     <li><a href="#options">Command-line options</a></li>
     33   </ol>
     34   <h2>See Also</h2>
     35   <ol>
     36     <li><a href="{@docRoot}guide/developing/tools/emulator.html">Android 
     37         Emulator</a></li>
     38   </ol>
     39 </div>
     40 </div>
     41 
     42 <p>Android Virtual Devices (AVDs) are configurations of emulator options that let
     43 you better model an actual device.</p>
     44 
     45 <p>Each AVD is made up of: </p>
     46 
     47 <ul>
     48 <li>A hardware profile.&nbsp;&nbsp;You can set options to define the hardware
     49 features of the virtual device. For example, you can define whether the device
     50 has a camera, whether it uses a physical QWERTY keyboard or a dialing pad, how
     51 much memory it has, and so on. </li>
     52 <li>A mapping to a system image.&nbsp;&nbsp;You can define what version of the
     53 Android platform will run on the virtual device. You can choose a version of the
     54 standard Android platform or the system image packaged with an SDK add-on.</li>
     55 <li>Other options.&nbsp;&nbsp;You can specify the emulator skin you want to use
     56 with the AVD, which lets you control the screen dimensions, appearance, and so
     57 on. You can also specify the emulated SD card to use with the AVD.</li>
     58 <li>A dedicated storage area on your development machine, in which is stored the
     59 device's user data (installed applications, settings, and so on) and emulated SD
     60 card.</li>
     61 </ul>
     62 
     63 <p>You can create as many AVDs as you need, based on the types of devices you
     64 want to model and the Android platforms and external libraries you want to run
     65 your application on. </p>
     66 
     67 <p>In addition to the options in an AVD configuration, you can also
     68 specify emulator command-line options at launch or by using the emulator
     69 console to change behaviors or characteristics at run time. For a complete
     70 reference of emulator options, please see the <a
     71 href="{@docRoot}guide/developing/tools/emulator.html">Emulator</a>
     72 documentation. </p>
     73 
     74 <p>The easiest way to create an AVD is to use the graphical AVD Manager, which
     75 you can launch from Eclipse or from the command line using the
     76 <code>android</code> tool. The <code>android</code> tool is provided in the
     77 <code>tools/</code> directory of the Android SDK. When you run the
     78 <code>android</code> tool without options, it launches the graphical AVD
     79 Manager.</p>
     80 
     81 <p>For more information about how to work with AVDs from inside your development
     82 environment, see <a
     83 href="{@docRoot}guide/developing/eclipse-adt.html">Developing in Eclipse with
     84 ADT</a> or <a href="{@docRoot}guide/developing/other-ide.html">Developing in
     85 Other IDEs</a>, as appropriate for your environment.</p>
     86 
     87 <h2 id="creating">Creating an AVD</h2>
     88 
     89 <div class="sidebox-wrapper">
     90 <div class="sidebox">
     91 <p>The Android SDK does not include any preconfigured AVDs, so
     92 you need to create an AVD before you can run any application in the emulator
     93 (even the Hello World application).</p>
     94 </div>
     95 </div>
     96 <p>The easiest way to create an AVD is to use the graphical AVD Manager, but the
     97 <code>android</code> tool also offers a <a href="#options">command line option</a>.</p>
     98 <p>To create an AVD:</p>
     99 <ol>
    100   <li>In Eclipse, choose <strong>Window &gt; Android SDK and AVD Manager</strong>. </li>
    101   <p>Alternatively, you can launch the graphical AVD Manager by running the
    102 <code>android</code> tool with no options.</p>
    103   <li>Select <strong>Virtual Devices</strong> in the left panel.</li>
    104 
    105   <li>Click <strong>New</strong>. </li>
    106 
    107 <p>The <strong>Create New AVD</strong> dialog appears.</p> <a
    108 href="{@docRoot}images/developing/avd-dialog.png"><img
    109 src="{@docRoot}images/developing/avd-dialog.png" alt="AVD
    110 Dialog" /></a>
    111 
    112   <li>Type the name of the AVD, such as "my_avd".</li>
    113   <li>Choose a target. </li>
    114 <p>The target is the system image that you want to run on the emulator,
    115 from the set of platforms that are installed in your SDK environment. You can
    116 choose a version of the standard Android platform or an SDK add-on. For more
    117 information about how to add platforms to your SDK, see <a
    118 href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>. </p>
    119   <li>Optionally specify any additional settings: </li>
    120   <dl>
    121   <dt><em>SD Card</em></dt> <dd>The path to the SD card image to use with this
    122 AVD, or the size of a new SD card image to create for this AVD.</dd> </dl>
    123 <dt><em>Skin</em></dt>
    124     <dd>The skin to use for this AVD, identified by name or dimensions.</dd>
    125 <dt><em>Hardware</em></dt>
    126     <dd>The hardware emulation options for the device. For a list of the options, see 
    127 <a href="#hardwareopts">Setting hardware emulation options</a>.</dd>
    128   </dl>
    129   <li>Click <strong>Create AVD</strong>.</li>
    130 </ol>
    131 
    132 <h3 id="hardwareopts">Setting hardware emulation options</h3>
    133 
    134 <p>When you create a new AVD that uses a standard Android system image ("Type:
    135 platform"), the AVD Manager
    136  lets you set hardware emulation
    137 options for your virtual device. 
    138 The table below lists the options available and the
    139 default values, as well as the names of properties that store the emulated
    140 hardware options in the AVD's configuration file (the <code>config.ini</code> file in the
    141 AVD's local directory). </p>
    142 
    143 <table>
    144 <tr>
    145 <th>Characteristic</th>
    146 <th>Description</th>
    147 <th>Property</th>
    148 </tr>
    149 
    150 <tr>
    151 <td>Device ram size</td>
    152 <td>The amount of physical RAM on the device, in megabytes. Default value is "96".
    153 <td>hw.ramSize</td>
    154 </tr>
    155 
    156 <tr>
    157 <td>Touch-screen support</td>
    158 <td>Whether there is a touch screen or not on the device. Default value is "yes".</td>
    159 <td>hw.touchScreen
    160 
    161 <tr>
    162 <td>Trackball support </td>
    163 <td>Whether there is a trackball on the device. Default value is "yes".</td>
    164 <td>hw.trackBall</td>
    165 </tr>
    166 
    167 <tr>
    168 
    169 <td>Keyboard support</td>
    170 <td>Whether the device has a QWERTY keyboard. Default value is "yes".</td>
    171 <td>hw.keyboard</td>
    172 </tr>
    173 
    174 <tr>
    175 <td>DPad support</td>
    176 <td>Whether the device has DPad keys. Default value is "yes".</td>
    177 <td>hw.dPad</td>
    178 </tr>
    179 
    180 <tr>
    181 <td>GSM modem support</td>
    182 <td>Whether there is a GSM modem in the device. Default value is "yes".</td>
    183 <td>hw.gsmModem</td>
    184 </tr>
    185 
    186 <tr>
    187 <td>Camera support</td>
    188 <td>Whether the device has a camera. Default value is "no".</td>
    189 <td>hw.camera</td>
    190 </tr>
    191 
    192 <tr>
    193 <td>Maximum horizontal camera pixels</td>
    194 <td>Default value is "640".</td>
    195 <td>hw.camera.maxHorizontalPixels</td>
    196 </tr>
    197 
    198 <tr>
    199 <td>Maximum vertical camera pixels</td>
    200 <td>Default value is "480".</td>
    201 <td>hw.camera.maxVerticalPixels</td>
    202 
    203 </tr>
    204 
    205 <tr>
    206 <td>GPS support</td>
    207 <td>Whether there is a GPS in the device. Default value is "yes".</td>
    208 <td>hw.gps</td>
    209 </tr>
    210 
    211 <tr>
    212 <td>Battery support</td>
    213 <td>Whether the device can run on a battery. Default value is "yes".</td>
    214 <td>hw.battery</td>
    215 
    216 </tr>
    217 
    218 <tr>
    219 <td>Accelerometer</td>
    220 <td>Whether there is an accelerometer in the device. Default value is "yes".</td>
    221 <td>hw.accelerometer</td>
    222 </tr>
    223 
    224 <tr>
    225 <td>Audio recording support</td>
    226 <td>Whether the device can record audio. Default value is "yes".</td>
    227 <td>hw.audioInput</td>
    228 
    229 </tr>
    230 
    231 <tr>
    232 <td>Audio playback support</td>
    233 <td>Whether the device can play audio. Default value is "yes".</td>
    234 <td>hw.audioOutput</td>
    235 </tr>
    236 
    237 <tr>
    238 <td>SD Card support</td>
    239 <td>Whether the device supports insertion/removal of virtual SD Cards. Default value is "yes".</td>
    240 <td>hw.sdCard</td>
    241 
    242 </tr>
    243 
    244 <tr>
    245 <td>Cache partition support</td>
    246 <td>Whether we use a /cache partition on the device. Default value is "yes".</td>
    247 <td>disk.cachePartition</td>
    248 </tr>
    249 
    250 <tr>
    251 <td>Cache partition size</td>
    252 <td>Default value is "66MB".</td>
    253 <td>disk.cachePartition.size </td>
    254 
    255 </tr>
    256 
    257 <tr>
    258 <td>Abstracted LCD density</td>
    259 <td>Sets the generalized density characteristic used by the AVD's screen. Most
    260 skins come with a value (which you can modify), but if a skin doesn't provide
    261 its own value, the default is 160. </td>
    262 <td>hw.lcd.density </td>
    263 </tr>
    264 
    265 <tr>
    266 <td>Max VM application heap size</td>
    267 <td>The maximum heap size a Dalvik application might allocate before being
    268 killed by the system. Value is in megabytes. Most skins come with a value (which
    269 you can modify), but if a skin doesn't provide its own value, the default is
    270 16.</td> 
    271 <td>vm.heapSize</td>
    272 </tr>
    273 
    274 </table>
    275 
    276 <h3 id="location">Default location of the AVD files</h3>
    277 
    278 <p>When you create an AVD, the AVD Manager creates a dedicated directory for it
    279 on your development computer. The directory contains the AVD configuration file,
    280 the user data image and SD card image (if available), and any other files
    281 associated with the device. Note that the directory does not contain a system
    282 image &mdash; instead, the AVD configuration file contains a mapping to the
    283 system image, which it loads when the AVD is launched. </p>
    284 
    285 <p>The AVD Manager also creates a <code>&lt;AVD name&gt;.ini</code> file for the
    286 AVD at the root of the <code>.android/avd</code> directory on your computer. The file
    287 specifies the location of the AVD directory and always remains at the root the
    288 .android directory.</p>
    289 
    290 <p>By default, the AVD Manager creates the AVD directory inside
    291 <code>~/.android/avd/</code> (on Linux/Mac), <code>C:\Documents and
    292 Settings\&lt;user&gt;\.android\</code> on Windows XP, and 
    293 <code>C:\Users\&lt;user&gt;\.android\</code> on Windows Vista. 
    294 If you want to use a custom location for the AVD directory, you 
    295 can do so by using the <code>-p &lt;path&gt;</code> option when 
    296 you create the AVD (command line tool only): </p>
    297 
    298 <pre>android create avd -n my_android1.5 -t 2 -p path/to/my/avd</pre>
    299 
    300 <p>If the <code>.android</code> directory is hosted on a network drive, we recommend using
    301 the <code>-p</code> option to place the AVD directory in another location. 
    302 The  AVD's <code>.ini</code> file remains in the <code>.android</code> directory on the network
    303 drive, regardless of the location of the AVD directory. </p>
    304 
    305 <h2 id="managing">Managing AVDs</h2>
    306 
    307 <p>The sections below provide more information about how to manage AVDs once you've created them. </p>
    308 
    309 <h3 id="moving">Moving an AVD</h3>
    310 
    311 <p>If you want to move or rename an AVD, you can do so using this command:</p>
    312 
    313 <pre>android move avd -n &lt;name&gt; [-&lt;option&gt; &lt;value&gt;] ...</pre>
    314 
    315 <p>The options for this command are listed in <a href="#options">Command-line
    316 options for AVDs</a> at the bottom of this page. </p>
    317 
    318 <h3 id="updating">Updating an AVD</h3>
    319 
    320 <p>
    321 If you rename or move the root directory of a platform (or add-on), an AVD configured to use that platform will no longer be able to load the system image properly. To fix the AVD, use the <strong>Repair...</strong> button in the AVD Manager. From the command line, you can also use the <code>android update avd</code> command to recompute the path to the system images.</p>
    322 
    323 <h3 id="deleting">Deleting an AVD</h3>
    324 
    325 <p>You can  delete an AVD in the AVD Manager by selecting the 
    326 AVD and clicking <strong>Delete</strong>.</p>
    327 
    328 <p>Alternatively, you can use the <code>android</code> tool to delete an AVD. Here is the command usage:</p>
    329 
    330 <pre>android delete avd -n &lt;name&gt; </pre>
    331 
    332 <p>When you issue the command, the <code>android</code> tool looks for an AVD matching the 
    333 specified name deletes the AVD's directory and files. </p>
    334 
    335 
    336 <h2 id="options">Command-line options</h2>
    337 
    338 <p>You can use the <code>android</code> tool to create and manage AVDs.</p>
    339 
    340 <p>The command line for creating an AVD has the following syntax:</p>
    341 
    342 <pre>
    343 android create avd -n &lt;name&gt; -t &lt;targetID&gt; [-&lt;option&gt; &lt;value&gt;] ... 
    344 </pre>
    345 
    346 <p>Here's an example that creates an AVD with the name "my_android2.2" and target ID "3":</p>
    347 
    348 <pre>
    349 android create avd -n my_android2.2 -t 3
    350 </pre>
    351 
    352 <p>The table below lists the command-line options you can use with the 
    353 <code>android</code> tool. </p>
    354 
    355 
    356 <table>
    357 <tr>
    358   <th width="15%">Action</th>
    359   <th width="20%">Option</th>
    360   <th width="30%">Description</th>
    361   <th>Comments</th>
    362 </tr>
    363 
    364 
    365 <tr>
    366   <td><code>list&nbsp;avds</code></td>
    367   <td>&nbsp;</td>
    368   <td>List all known AVDs, with name, path, target, and skin. </td>
    369   <td>&nbsp;</td>
    370 </tr>
    371 <tr>
    372   <td rowspan="6"><code>create&nbsp;avd</code></td>
    373   <td><code>-n &lt;name&gt; or <br></code></td>
    374   <td>The name for the AVD.</td>
    375   <td>Required</td>
    376 </tr>
    377 <tr>
    378   <td><code>-t &lt;targetID&gt;</code></td>
    379   <td>Target ID of the system image to use with the new AVD.</td>
    380   <td>Required. To obtain a list of available targets, use <code>android list
    381       targets</code>.</td>
    382 </tr>
    383 <tr>
    384   <td><code>-c &lt;path&gt;</code> or <br>
    385       <code>-c &lt;size&gt;[K|M]</code></td>
    386   <td>The path to the SD card image to use with this AVD or the size of a new SD
    387       card image to create for this AVD.</td>
    388   <td>Examples: <code>-c path/to/sdcard</code> or <code>-c 1000M</code></td>
    389 </tr>
    390 <tr>
    391   <td><code>-f</code></td>
    392   <td>Force creation of the AVD</td>
    393   <td>By default, if the name of the AVD being created matches that of an 
    394       existing AVD, the <code>android</code> tool will not create the new AVD or overwrite 
    395       the existing AVD. If you specify the <code>-f</code> option, however, the 
    396       <code>android</code> tool will automatically overwrite any existing AVD that has the 
    397       same name as the new AVD. The files and data of the existing AVD are 
    398       deleted. </td>
    399 </tr>
    400 
    401 <tr>
    402   <td><code>-p &lt;path&gt;</code></td>
    403   <td>Path to the location at which to create the directory for this AVD's
    404 files.</td>
    405   <td>&nbsp;</td>
    406 </tr>
    407 <tr>
    408   <td><code>-s &lt;name&gt;</code> or <br>
    409       <code>-s &lt;width&gt;-&lt;height&gt;</code> </td>
    410   <td>The skin to use for this AVD, identified by name or dimensions.</td>
    411   <td>The <code>android</code> tool scans for a matching skin by name or dimension in the
    412 <code>skins/</code> directory of the target referenced in the <code>-t
    413 &lt;targetID&gt;</code> argument. Example: <code>-s HVGA-L</code></td>
    414 </tr>
    415 <tr>
    416   <td><code>delete&nbsp;avd</code></td>
    417   <td><code>-n &lt;name&gt;</code></td>
    418   <td>Delete the specified AVD.</td>
    419   <td>Required</td>
    420 </tr>
    421 <tr>
    422   <td rowspan="3"><code>move&nbsp;avd</code></td>
    423   <td><code>-n &lt;name&gt;</code></td>
    424   <td>The name of the AVD to move.</td>
    425   <td>Required</td>
    426 </tr>
    427 <tr>
    428   <td><code>-p &lt;path&gt;</code></td>
    429   <td>The path to the new location for the AVD.</td>
    430   <td>&nbsp;</td>
    431 </tr>
    432 <tr>
    433   <td><code>-r &lt;new-name&gt;</code></td>
    434   <td>Rename the AVD.</td>
    435   <td>&nbsp;</td>
    436 </tr>
    437 <tr>
    438   <td><code>update&nbsp;avds</code></td>
    439   <td>&nbsp;</td>
    440   <td>Recompute the paths to all system images.</td>
    441   <td>&nbsp;</td>
    442 </tr>
    443 
    444 
    445 
    446 </table>
    447 
    448