blob: ca197cfb0d15a9b3bae95f8e64be8f3502dbc4d0 [file] [log] [blame]
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -07001page.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>
Katie McCormickc46efe62010-07-08 15:24:16 -070014 <li>You can launch a graphical Android AVD Manager either through Eclipse or
15through the <code>android</code> tool. The <code>android</code> tool also offers
16a command-line interface for creating and managing AVDs.</li> </ul>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070017 <h2>In this document</h2>
18 <ol>
19 <li><a href="#creating">Creating an AVD</a>
20 <ol>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070021 <li><a href="#hardwareopts">Setting hardware emulation options</a></li>
22 <li><a href="#location">Default location of the AVD files</a></li>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070023 </ol>
24 </li>
25 <li><a href="#managing">Managing AVDs</a>
26 <ol>
27 <li><a href="#moving">Moving an AVD</a></li>
Dirk Dougherty6565a5a2009-04-21 20:25:36 -070028 <li><a href="#updating">Updating an AVD</a></li>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070029 <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>
Dirk Dougherty6565a5a2009-04-21 20:25:36 -070036 <li><a href="{@docRoot}guide/developing/tools/emulator.html">Android
37 Emulator</a></li>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070038 </ol>
39</div>
40</div>
41
42<p>Android Virtual Devices (AVDs) are configurations of emulator options that let
43you 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
49features of the virtual device. For example, you can define whether the device
50has a camera, whether it uses a physical QWERTY keyboard or a dialing pad, how
51much memory it has, and so on. </li>
52<li>A mapping to a system image.&nbsp;&nbsp;You can define what version of the
53Android platform will run on the virtual device. You can choose a version of the
54standard 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
56with the AVD, which lets you control the screen dimensions, appearance, and so
57on. 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
59device's user data (installed applications, settings, and so on) and emulated SD
60card.</li>
61</ul>
62
63<p>You can create as many AVDs as you need, based on the types of devices you
64want to model and the Android platforms and external libraries you want to run
65your application on. </p>
66
67<p>In addition to the options in an AVD configuration, you can also
68specify emulator command-line options at launch or by using the emulator
69console to change behaviors or characteristics at run time. For a complete
70reference of emulator options, please see the <a
Dirk Dougherty752aaf92009-04-27 18:13:11 -070071href="{@docRoot}guide/developing/tools/emulator.html">Emulator</a>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070072documentation. </p>
73
Katie McCormickc46efe62010-07-08 15:24:16 -070074<p>The easiest way to create an AVD is to use the graphical AVD Manager, which
75you 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
79Manager.</p>
Dirk Doughertya6602f12009-08-27 16:26:43 -070080
81<p>For more information about how to work with AVDs from inside your development
82environment, see <a
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070083href="{@docRoot}guide/developing/eclipse-adt.html">Developing in Eclipse with
84ADT</a> or <a href="{@docRoot}guide/developing/other-ide.html">Developing in
85Other IDEs</a>, as appropriate for your environment.</p>
86
87<h2 id="creating">Creating an AVD</h2>
88
Dirk Dougherty752aaf92009-04-27 18:13:11 -070089<div class="sidebox-wrapper">
Scott Mainf54574a2010-03-24 17:18:01 -070090<div class="sidebox">
Dirk Dougherty752aaf92009-04-27 18:13:11 -070091<p>The Android SDK does not include any preconfigured AVDs, so
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -070092you need to create an AVD before you can run any application in the emulator
Dirk Dougherty752aaf92009-04-27 18:13:11 -070093(even the Hello World application).</p>
94</div>
95</div>
Katie McCormickc46efe62010-07-08 15:24:16 -070096<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>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700104
Katie McCormickc46efe62010-07-08 15:24:16 -0700105 <li>Click <strong>New</strong>. </li>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700106
Katie McCormickc46efe62010-07-08 15:24:16 -0700107<p>The <strong>Create New AVD</strong> dialog appears.</p> <a
108href="{@docRoot}images/developing/avd-dialog.png"><img
109src="{@docRoot}images/developing/avd-dialog.png" alt="AVD
110Dialog" /></a>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700111
Katie McCormickc46efe62010-07-08 15:24:16 -0700112 <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,
115from the set of platforms that are installed in your SDK environment. You can
116choose a version of the standard Android platform or an SDK add-on. For more
117information about how to add platforms to your SDK, see <a
118href="{@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
122AVD, 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>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700131
132<h3 id="hardwareopts">Setting hardware emulation options</h3>
133
Katie McCormickc46efe62010-07-08 15:24:16 -0700134<p>When you create a new AVD that uses a standard Android system image ("Type:
135platform"), the AVD Manager
136 lets you set hardware emulation
137options for your virtual device.
138The table below lists the options available and the
Dirk Doughertya6602f12009-08-27 16:26:43 -0700139default values, as well as the names of properties that store the emulated
Katie McCormickc46efe62010-07-08 15:24:16 -0700140hardware options in the AVD's configuration file (the <code>config.ini</code> file in the
Dirk Doughertya6602f12009-08-27 16:26:43 -0700141AVD's local directory). </p>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700142
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
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700161<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>
Katie McCormickc46efe62010-07-08 15:24:16 -0700168
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700169<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>
Katie McCormickc46efe62010-07-08 15:24:16 -0700202
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700203</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>
Katie McCormickc46efe62010-07-08 15:24:16 -0700215
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700216</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>
Katie McCormickc46efe62010-07-08 15:24:16 -0700228
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700229</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>
Katie McCormickc46efe62010-07-08 15:24:16 -0700241
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700242</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>
Katie McCormickc46efe62010-07-08 15:24:16 -0700254
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700255</tr>
Dirk Doughertya6602f12009-08-27 16:26:43 -0700256
257<tr>
258<td>Abstracted LCD density</td>
Katie McCormickc46efe62010-07-08 15:24:16 -0700259<td>Sets the generalized density characteristic used by the AVD's screen. Most
260skins come with a value (which you can modify), but if a skin doesn't provide
261its own value, the default is 160. </td>
Dirk Doughertya6602f12009-08-27 16:26:43 -0700262<td>hw.lcd.density </td>
263</tr>
264
Katie McCormickc46efe62010-07-08 15:24:16 -0700265<tr>
266<td>Max VM application heap size</td>
267<td>The maximum heap size a Dalvik application might allocate before being
268killed by the system. Value is in megabytes. Most skins come with a value (which
269you can modify), but if a skin doesn't provide its own value, the default is
27016.</td>
271<td>vm.heapSize</td>
272</tr>
273
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700274</table>
275
276<h3 id="location">Default location of the AVD files</h3>
277
Katie McCormickc46efe62010-07-08 15:24:16 -0700278<p>When you create an AVD, the AVD Manager creates a dedicated directory for it
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700279on your development computer. The directory contains the AVD configuration file,
280the user data image and SD card image (if available), and any other files
281associated with the device. Note that the directory does not contain a system
282image &mdash; instead, the AVD configuration file contains a mapping to the
283system image, which it loads when the AVD is launched. </p>
284
Katie McCormickc46efe62010-07-08 15:24:16 -0700285<p>The AVD Manager also creates a <code>&lt;AVD name&gt;.ini</code> file for the
286AVD at the root of the <code>.android/avd</code> directory on your computer. The file
287specifies the location of the AVD directory and always remains at the root the
288.android directory.</p>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700289
Katie McCormickc46efe62010-07-08 15:24:16 -0700290<p>By default, the AVD Manager creates the AVD directory inside
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700291<code>~/.android/avd/</code> (on Linux/Mac), <code>C:\Documents and
292Settings\&lt;user&gt;\.android\</code> on Windows XP, and
293<code>C:\Users\&lt;user&gt;\.android\</code> on Windows Vista.
294If you want to use a custom location for the AVD directory, you
295can do so by using the <code>-p &lt;path&gt;</code> option when
Katie McCormickc46efe62010-07-08 15:24:16 -0700296you create the AVD (command line tool only): </p>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700297
298<pre>android create avd -n my_android1.5 -t 2 -p path/to/my/avd</pre>
299
Katie McCormickc46efe62010-07-08 15:24:16 -0700300<p>If the <code>.android</code> directory is hosted on a network drive, we recommend using
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700301the <code>-p</code> option to place the AVD directory in another location.
Katie McCormickc46efe62010-07-08 15:24:16 -0700302The AVD's <code>.ini</code> file remains in the <code>.android</code> directory on the network
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700303drive, regardless of the location of the AVD directory. </p>
304
Dirk Dougherty6565a5a2009-04-21 20:25:36 -0700305<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
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700309<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
316options for AVDs</a> at the bottom of this page. </p>
317
318<h3 id="updating">Updating an AVD</h3>
319
Katie McCormickc46efe62010-07-08 15:24:16 -0700320<p>
321If 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>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700322
323<h3 id="deleting">Deleting an AVD</h3>
324
Katie McCormickc46efe62010-07-08 15:24:16 -0700325<p>You can delete an AVD in the AVD Manager by selecting the
326AVD 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>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700329
330<pre>android delete avd -n &lt;name&gt; </pre>
331
Dirk Doughertya6602f12009-08-27 16:26:43 -0700332<p>When you issue the command, the <code>android</code> tool looks for an AVD matching the
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700333specified name deletes the AVD's directory and files. </p>
334
335
Katie McCormickc46efe62010-07-08 15:24:16 -0700336<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>
343android 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>
349android create avd -n my_android2.2 -t 3
350</pre>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700351
352<p>The table below lists the command-line options you can use with the
Dirk Doughertya6602f12009-08-27 16:26:43 -0700353<code>android</code> tool. </p>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700354
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
Dirk Doughertya6602f12009-08-27 16:26:43 -0700394 existing AVD, the <code>android</code> tool will not create the new AVD or overwrite
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700395 the existing AVD. If you specify the <code>-f</code> option, however, the
Dirk Doughertya6602f12009-08-27 16:26:43 -0700396 <code>android</code> tool will automatically overwrite any existing AVD that has the
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700397 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
404files.</td>
405 <td>&nbsp;</td>
406</tr>
407<tr>
408 <td><code>-s &lt;name&gt;</code> or <br>
Dirk Dougherty6565a5a2009-04-21 20:25:36 -0700409 <code>-s &lt;width&gt;-&lt;height&gt;</code> </td>
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700410 <td>The skin to use for this AVD, identified by name or dimensions.</td>
Dirk Doughertya6602f12009-08-27 16:26:43 -0700411 <td>The <code>android</code> tool scans for a matching skin by name or dimension in the
Dirk Doughertyf20e1bd2009-04-20 21:53:32 -0700412<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