• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Android Emulator
2@jd:body
3
4<div style="padding:1em;"><img src="/images/emulator-wvga800l.png" alt="Image of the Android Emulator" width="367" height="349" style="margin-left:2em;margin-top:-4em;float:right;"/></div>
5
6<p>The Android SDK includes a mobile device emulator -- a virtual mobile device
7that runs on your computer. The emulator lets you prototype, develop, and test
8Android applications without using a physical device. </p>
9
10<p>The Android emulator mimics all of the hardware and software features
11of a typical mobile device, except that it can not receive or place actual phone
12calls. It provides a variety of navigation and control keys, which you can "press"
13using your mouse or keyboard to generate events for your application. It also
14provides a screen in which your application is displayed, together with any other
15Android applications running. </p>
16
17<p>To let you model and test your application more easily, the emulator supports
18Android Virtual Device (AVD) configurations. AVDs let you specify the Android
19platform that you want to run on the emulator, as well as the hardware options
20and emulator skin files tht you want to use. Once your application is running on
21the emulator, it can use the services of the Android platform to invoke other
22applications, access the network, play audio and video, store and retrieve data,
23notify the user, and render graphical transitions and themes. </p>
24
25<p>The emulator also includes a variety of debug capabilities, such as a console
26from which you can log kernel output, simulate application interrupts (such as
27arriving SMS messages or phone calls), and simulate latency effects and dropouts
28on the data channel.</p>
29
30<table>
31<tr>
32<td colspan="2" style="border:0;"><strong>In this document:</strong></td>
33</tr>
34<tr>
35<td style="border:0;">
36
37<ol class="toc">
38<li><a href="#overview">Overview</a></li>
39<li><a href="#starting">Starting and Stopping the Emulator</a></li>
40<li><a href="#starting">Android Virtual Devices and the Emulator</a></li>
41<li><a href="#controlling">Controlling the Emulator</a></li>
42<li><a href="#startup-options">Emulator Startup Options</a></li>
43<li><a href="#diskimages">Working with Emulator Disk Images</a>
44	<ol class="toc">
45	<li><a href="#defaultimages">Default Images</a></li>
46	<li><a href="#runtimeimages">Runtime Images: User Data and SD Card</a></li>
47	<li><a href="#temporaryimages">Temporary Images</a></li>
48	</ol></li>
49<li><a href="#emulatornetworking">Emulator Networking</a>
50	<ol class="toc">
51	<li><a href="#networkaddresses">Network Address Space</a></li>
52	<li><a href="#networkinglimitations">Local Networking Limitations</a></li>
53	<li><a href="#redirections">Using Network Redirections</a></li>
54	<li><a href="#dns">Configuring the Emulator's DNS Settings</a></li>
55	<li><a href="#proxy">Using the Emulator with a Proxy</a></li>
56	<li><a href="#connecting">Interconnecting Emulator Instances</a></li>
57	<li><a href="#calling">Sending a Voice Call or SMS to Another Emulator Instance</a></li>
58	</ol></li>
59</ol>
60</td>
61
62<td style="border:0;">
63<ol class="toc">
64<li><a href="#console">Using the Emulator Console</a>
65	<ol class="toc">
66	<li><a href="#portredirection">Port Redirections</a></li>
67	<li><a href="#geo">Geo Location Provider Emulation</a></li>
68	<li><a href="#events">Sending Events</a></li>
69	<li><a href="#power">Emulating Device Power Characteristics</a></li>
70	<li><a href="#netstatus">Network Status</a></li>
71	<li><a href="#netdelay">Network Delay Emulation</a></li>
72	<li><a href="#netspeed">Network Speed Emulation</a></li>
73	<li><a href="#telephony">Telephony Emulation</a></li>
74	<li><a href="#sms">SMS Emulation</a></li>
75	<li><a href="#vm">VM State</a></li>
76	<li><a href="#window">Emulator Window</a></li>
77	<li><a href="#terminating">Terminating an Emulator Instance</a></li>
78	</ol></li>
79<li><a href="#skins">Using Emulator Skins</a></li>
80<li><a href="#multipleinstances">Running Multiple Instances of the Emulator</a></li>
81<li><a href="#apps">Installing Applications on the Emulator</a></li>
82<li><a href="#sdcard">SD Card Emulation</a>
83	<ol class="toc">
84	<li><a href="#creatinga">Creating an SD card image using the android tool</li>
85	<li><a href="#creatingm">Creating an SD card image using mksdcard</a></li>
86	<li><a href="#copying">Copying Files to a Disk Image</a></li>
87	<li><a href="#loading">Loading the Disk Image at Emulator Startup</a></li>
88	</ol></li>
89<li><a href="#troubleshooting">Troubleshooting Emulator Problems</a></li>
90<li><a href="#limitations">Emulator Limitations</a></li>
91</ol>
92</td>
93
94</table>
95
96<a name="overview"></a>
97
98<h2>Overview</h2>
99
100<p>The Android emulator is a QEMU-based application that provides a virtual ARM
101mobile device on which you can run your Android applications. It runs a full
102Android system stack, down to the kernel level, that includes a set of
103preinstalled applications (such as the dialer) that you can access from your
104applications. You can choose what version of the Android system you want to
105run in the emulator by configuring AVDs, and you can also customize the
106mobile device skin and key mappings. When launching the emulator and at runtime,
107you can use a variety of commands and options to control the its behaviors.
108</p>
109
110<p>The Android system image distributed in the SDK contains ARM machine code for
111the Android Linux kernel, the native libraries, the Dalvik VM, and the various
112Android package files (such as for for the Android framework and preinstalled
113applications). The emulator's QEMU layers provide dynamic binary translation of
114the ARM machine code to the OS and processor architecture of your development
115machine. </p>
116
117<p>Adding custom capabilities to the underlying QEMU services, the Android
118emulator supports many hardware features likely to be found on mobile devices,
119including: </p>
120
121<ul>
122  <li>An ARMv5 CPU and the corresponding memory-management unit (MMU)</li>
123  <li>A 16-bit LCD display</li>
124  <li>One or more keyboards (a Qwerty-based keyboard and associated Dpad/Phone
125buttons)</li>
126  <li>A sound chip with output and input capabilities</li>
127  <li>Flash memory partitions (emulated through disk image files on the
128development machine)</li>
129  <li>A GSM modem, including a simulated SIM Card</li>
130</li>
131</ul>
132
133<p>The sections below provide more information about the emulator and how to use
134it for developing Android applications.</p>
135
136<a name="starting"></a>
137
138<h2>Starting and Stopping the Emulator</h2>
139
140<p>During development and testing of your application, you install and run your
141application in the Android emulator. You can launch the emulator as a standalone
142application, from a command line, or you can use it as part of your Eclipse
143development environment. In either case, you specify the AVD configuration to
144load and any startup options you want to use, as described in this document.
145</p>
146
147<p>You can run your application on a single instance of the emulator or,
148depending on your needs, you can start multiple emulator instances and run your
149application in more than one emulated device. You can use the emulator's
150built-in commands to simulate GSM phone calling or SMS between emulator
151instances, and you can set up network redirections that allow emulators to send
152data to one another. For more information, see <a href="#telephony">Telephony
153Emulation</a>, <a href="#sms">SMS Emulation</a>, and
154<a href="#emulatornetworking">Emulator Networking</a></p>
155
156<p>To start an instance of the emulator from the command line, change to the
157<code>tools/</code> folder of the SDK. Enter <code>emulator</code> command
158like this: </p>
159
160<pre>emulator -avd &lt;avd_name&gt;</pre>
161
162<p>This initializes the emulator and loads an AVD configuration (see the next
163section for more information about AVDs). You will see the emulator window
164appear on your screen. </p>
165
166<p>If you are working in Eclipse, the ADT plugin for Eclipse installs your
167application and starts the emulator automatically, when you run or debug
168the application. You can specify emulator startup options in the Run/Debug
169dialog, in the Target tab. When the emulator is running, you can issue
170console commands as described later in this document.</p>
171
172<p>If you are not working in Eclipse, see <a href="#apps">Installing Applications
173on the Emulator</a> for information about how to install your application.</p>
174
175<p>To stop an emulator instance, just close the emulator's window.</p>
176
177<a name="controlling"></a>
178
179<a name="avds"></a>
180
181<h2>Android Virtual Devices and the Emulator</h2>
182
183<p>To use the emulator, you first must create one or more AVD configurations. In each
184configuration, you specify an Android platform to run in the emulator and the set of hardware
185options and emulator skin you want to use. Then, when you launch the emulator, you specify
186the AVD configuration that you want to load. </p>
187
188<p>To specify the AVD you want to load when starting the emulator, you use the
189<code>-avd</code> argument, as shown in the previous section. </p>
190
191<p>Each AVD functions as an independent device, with its own private storage for
192user data, SD card, and so on. When you launch the emulator with an AVD configuration,
193it automatically loads the user data and SD card data from the AVD directory. By default,
194the emulator stores the user data, SD card data, and cache in the AVD directory.</p>
195
196<p>To create and manage AVDs you use the android tool, a command-line utility
197included in the SDK. For complete information about how to set up AVDs, see <a
198href="{@docRoot}guide/developing/tools/avd.html">Android Virtual Devices</a>.</p>
199
200<h2>Controlling the Emulator</h2>
201
202<p>You can use emulator <a href="#startup-options">startup options</a> and <a
203href="#console">console commands</a> to control the behaviors and
204characteristics of the emulated environment itself.
205</p>
206
207<p>When the emulator is running, you can interact with the emulated mobile
208device just as you would an actual mobile device, except that you use your mouse
209pointer to &quot;touch&quot; the touchscreen and your keyboard keys to
210&quot;press&quot; the simulated device keys. </p>
211
212<p>The table below summarizes the mappings between the emulator keys and and
213the keys of your keyboard. </p>
214
215<table  border="0" style="clear:left;">
216  <tr>
217    <th>Emulated Device Key </th>
218    <th>Keyboard Key </th>
219  </tr>
220  <tr>
221    <td>Home</td>
222    <td>HOME</td>
223  </tr>
224  <tr>
225    <td>Menu (left softkey)</td>
226    <td>F2 <em>or</em> Page-up button</td>
227  </tr>
228  <tr>
229    <td>Star (right softkey)</td>
230    <td>Shift-F2 <em>or </em>Page Down</td>
231  </tr>
232  <tr>
233    <td>Back</td>
234    <td>ESC</td>
235  </tr>
236  <tr>
237    <td>Call/dial button </td>
238    <td>F3</td>
239  </tr>
240  <tr>
241    <td>Hangup/end call button</td>
242    <td>F4</td>
243  </tr>
244  <tr>
245    <td>Search</td>
246    <td>F5 </td>
247  </tr>
248  <tr>
249    <td>Power button</td>
250    <td>F7 </td>
251  </tr>
252  <tr>
253    <td>Audio volume up button</td>
254    <td>KEYPAD_PLUS, Ctrl-5</td>
255  </tr>
256
257  <tr>
258    <td>Audio volume down button</td>
259    <td>KEYPAD_MINUS, Ctrl-F6</td>
260  </tr>
261  <tr>
262    <td>Camera button</td>
263    <td>Ctrl-KEYPAD_5, Ctrl-F3</td>
264  </tr>
265  <tr>
266    <td>Switch to previous layout orientation (for example, portrait, landscape)</td>
267    <td>KEYPAD_7, Ctrl-F11</td>
268  </tr>
269  <tr>
270    <td>Switch to next layout orientation (for example, portrait, landscape)</td>
271    <td>KEYPAD_9, Ctrl-F12</td>
272  </tr>
273  <tr>
274    <td>Toggle cell networking on/off</td>
275    <td>F8</td>
276  </tr>
277  <tr>
278    <td>Toggle code profiling</td>
279    <td>F9 (only with <code>-trace</code> startup option)</td>
280  </tr>
281  <tr>
282    <td>Toggle fullscreen mode</td>
283    <td>Alt-Enter</td>
284  </tr>
285  <tr>
286    <td>Toggle trackball mode</td>
287    <td>F6</td>
288  </tr>
289  <tr>
290    <td>Enter trackball mode temporarily (while key is pressed)</td>
291    <td>Delete</td>
292  </tr>
293  <tr>
294    <td>DPad left/up/right/down</td>
295    <td>KEYPAD_4/8/6/2</td>
296  </tr>
297  <tr>
298    <td>DPad center click</td>
299    <td>KEYPAD_5</td>
300  </tr>
301  <tr>
302    <td>Onion alpha increase/decrease</td>
303    <td>KEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)</td>
304  </tr>
305</table>
306
307<p>Note that, to use keypad keys, you must first disable NumLock on your development computer. </p>
308
309<a name="startup-options"></a>
310
311<h2> Emulator Startup Options</h2>
312<p>The emulator supports a variety of options that you can specify
313when launching the emulator, to control its appearance or behavior.
314Here's the command-line usage for launching the emulator with options: </p>
315
316<pre>emulator -avd &lt;avd_name&gt; [-&lt;option&gt; [&lt;value&gt;]] ... [-&lt;qemu args&gt;]</pre>
317
318<p>The table below summarizes the available options.</p>
319
320<table>
321<tr>
322  <th width="10%" >Category</th>
323  <th width="20%" >Option</th>
324    <th width="30%" >Description</th>
325    <th width="40%" >Comments</th>
326</tr>
327
328<tr>
329  <td rowspan="9">Help</td>
330  <td><code>-help</code></td>
331  <td>Print a list of all emulator options.</td>
332  <td>&nbsp;</td>
333</tr>
334<tr>
335  <td><code>-help-all</code></td>
336  <td>Print help for all startup options.</td>
337  <td>&nbsp;</td>
338</tr>
339<tr>
340  <td><code>-help-&lt;option&gt;</code></td>
341  <td>Print help for a specific startup option.</td>
342  <td>&nbsp;</td>
343</tr>
344<tr>
345  <td><code>-help-debug-tags</code></td>
346  <td>Print a list of all tags for <code>-debug &lt;tags&gt;</code>.</td>
347  <td>&nbsp;</td>
348</tr>
349<tr>
350  <td><code>-help-disk-images</code></td>
351  <td>Print help for using emulator disk images.</td>
352  <td>&nbsp;</td>
353</tr>
354<tr>
355  <td><code>-help-environment</code></td>
356  <td>Print help for emulator environment variables.</td>
357  <td>&nbsp;</td>
358</tr><tr>
359  <td><code>-help-keys</code></td>
360  <td>Print the current mapping of keys.</td>
361  <td>&nbsp;</td>
362</tr>
363<tr>
364  <td><code>-help-keyset-file</code></td>
365  <td>Print help for defining a custom key mappings file.</td>
366  <td>&nbsp;</td>
367</tr>
368<tr>
369  <td><code>-help-virtual-device</code></td>
370  <td>Print help for Android Virtual Device usage.</td>
371  <td>&nbsp;</td>
372</tr>
373<tr>
374  <td>AVD</td>
375  <td><code>-avd &lt;avd_name&gt;</code> or <br>
376      <code>@&lt;avd_name&gt;</code></td>
377  <td><strong>Required</strong>. Specifies the AVD to load for this emulator
378      instance.</td>
379  <td>You must create an AVD configuration before launching the emulator. For
380      information, see <a href="{@docRoot}guide/developing/tools/avd.html">Android
381      Virtual Devices</a>.</td>
382<tr>
383  <td rowspan="7">Disk Images</td>
384  <td><code>-cache&nbsp;&lt;filepath&gt;</code></td>
385  <td>Use &lt;filepath&gt; as the working cache partition image. </td>
386  <td>Optionally, you can specify a path relative to the current working directory.
387  If no cache file is specified, the emulator's default behavior is to use a temporary file instead.
388  <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
389</td></tr>
390<tr>
391  <td><code>-data&nbsp;&lt;filepath&gt;</code></td>
392  <td>Use &lt;filepath&gt; as the working user-data disk image. </td>
393  <td>Optionally, you can specify a path relative to the current working directory.
394  If <code>-data</code> is not used, the emulator looks for a file named &quot;userdata-qemu.img&quot;
395  in the storage area of the AVD being used (see <code>-avd</code>).
396</td></tr>
397<!--
398<tr>
399  <td><code>-datadir &lt;dir&gt;</code></td>
400  <td>Search for the user-data disk image specified in <code>-data</code> in &lt;dir&gt;</td>
401  <td><code>&lt;dir&gt;</code> is a path relative to the current working directory.
402
403<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image
404in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information
405on disk images, use <code>-help-disk-images</code>.</p>
406</td></tr>
407-->
408<!--
409<tr>
410  <td><code>-image&nbsp;&lt;filepath&gt;</code></td>
411  <td>Use &lt;filepath&gt; as the system image.</td>
412  <td>Optionally, you can specify a path relative to the current working directory.
413   Default is &lt;system&gt;/system.img.</td>
414</tr>
415-->
416<tr>
417  <td><code>-initdata&nbsp;&lt;filepath&gt;</code></td>
418  <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents
419  of this file to the new user-data disk image. By default, the emulator copies the <code>&lt;system&gt;/userdata.img</code>.</td>
420  <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>. <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td>
421</tr>
422<!--
423<tr>
424  <td><code>-kernel&nbsp;&lt;filepath&gt;</code></td>
425  <td>Use &lt;filepath&gt; as the emulated kernel.</td>
426  <td>Optionally, you can specify a path relative to the current working directory. </td>
427</tr>
428-->
429<tr>
430  <td><code>-nocache</code></td>
431  <td>Start the emulator without a cache partition.</td>
432  <td>See also <code>-cache &lt;file&gt;</code>.</td>
433</tr>
434<tr>
435  <td><code>-ramdisk&nbsp;&lt;filepath&gt;</code></td>
436  <td>Use &lt;filepath&gt; as the ramdisk image.</td>
437  <td>Default value is <code>&lt;system&gt;/ramdisk.img</code>.
438  <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
439</td>
440</tr>
441<tr>
442  <td><code>-sdcard&nbsp;&lt;filepath&gt;</code></td>
443  <td>Use &lt;file&gt; as the SD card image.</td>
444  <td>Default value is <code>&lt;system&gt;/sdcard.img</code>.
445  <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
446</td>
447</tr>
448<!--
449<tr>
450 <td><code>-system&nbsp;&lt;dirpath&gt;</code></td>
451 <td>Search for system, ramdisk and user data images in &lt;dir&gt;.</td>
452 <td><code>&lt;dir&gt;</code> is a directory path relative to the current
453  working directory.</td>
454</tr>
455-->
456<tr>
457  <td><code>-wipe-data</code></td>
458  <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and
459  <code>-data</code>, or the default file). The emulator deletes all data from the user data image file,
460  then copies the contents of the file at <code>-inidata</code> data to the image file before starting.
461  </td>
462  <td>See also <code>-initdata</code>.
463  <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
464</td>
465</tr>
466<tr>
467  <td rowspan="9">Debug</td>
468  <td><code>-debug &lt;tags&gt;</code></td>
469  <td>Enable/disable debug messages for the specified debug tags.</td>
470  <td><code>&lt;tags&gt;</code> is a space/comma/column-separated list of debug component names.
471  Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td>
472</tr>
473<tr>
474  <td><code>-debug-&lt;tag&gt;</code></td>
475  <td>Enable/disable debug messages for the specified debug tag.</td>
476  <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code>&lt;tag&gt;</code>. </td>
477</tr>
478<tr>
479  <td><code>-debug-no-&lt;tag&gt;</code></td>
480  <td>Disable debug messages for the specified debug tag.</td>
481</tr>
482<tr>
483  <td><code>-logcat &lt;logtags&gt;</code></td>
484  <td>Enable logcat output with given tags.</td>
485  <td>If the environment variable ANDROID_LOG_TAGS is defined and not
486    empty, its value will be used to enable logcat output by default.</td>
487</tr>
488<tr>
489  <td><code>-shell</code></td>
490  <td>Create a root shell console on the current terminal.</td>
491  <td>You can use this command even if the adb daemon in the emulated system is broken.
492  Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td>
493</tr>
494<tr>
495  <td><code>-shell-serial&nbsp;&lt;device&gt;</code></td>
496  <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character
497  device to use for communication with the shell.</td>
498  <td>&lt;device&gt; must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at
499  <a href="http://wiki.qemu.org/download/qemu-doc.html">wiki.qemu.org</a>
500  for more information.</p>
501
502<p>Here are some examples: </p>
503<ul>
504  <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li>
505  <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li>
506  <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li>
507  <li><code>-shell-serial fdpair:0:1</code> uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.</li>
508  </ul>
509</td>
510</tr>
511<tr>
512  <td><code>-show-kernel &lt;name&gt;</code></td>
513  <td>Display kernel messages.</td>
514  <td>&nbsp;</td>
515</tr>
516<tr>
517  <td><code>-trace &lt;name&gt;</code></td>
518  <td>Enable code profiling (press F9 to start), written to a specified file.</td>
519  <td>&nbsp;</td>
520</tr>
521<tr>
522  <td><code>-verbose</code></td>
523  <td>Enable verbose output.</td>
524  <td>Equivalent to <code>-debug-init</code>.
525<p>You can define the default verbose output options used by emulator instances in the Android environment variable
526ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option:
527<code>-debug-&lt;tags&gt;.</code> </p>
528<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options:
529<p><code>ANDROID_VERBOSE=init,modem</code></p>
530<p>For more information about debug tags, use <code>&lt;-help-debug-tags&gt;</code>.</p>
531</td>
532</tr>
533<tr>
534  <td rowspan="6">Media</td>
535  <td><code>-audio &lt;backend&gt;</code></td>
536  <td>Use the specified audio backend.</td>
537  <td>&nbsp;</td>
538</tr>
539<tr>
540  <td><code>-audio-in &lt;backend&gt;</code></td>
541  <td>Use the specified audio-input backend.</td>
542  <td>&nbsp;</td>
543</tr>
544<tr>
545  <td><code>-audio-out &lt;backend&gt;</code></td>
546  <td>Use the specified audio-output backend.</td>
547  <td>&nbsp;</td>
548</tr>
549<!--<tr>
550  <td><code>-mic &lt;device or file&gt;</code></td>
551  <td>Use device or WAV file for audio input.</td>
552  <td>&nbsp;</td>
553</tr>
554-->
555<tr>
556  <td><code>-noaudio</code></td>
557  <td>Disable audio support in the current emulator instance.</td>
558  <td>&nbsp;</td>
559</tr>
560<tr>
561  <td><code>-radio &lt;device&gt;</code></td>
562  <td>Redirect radio modem interface to a host character device.</td>
563  <td>&nbsp;</td></tr>
564<tr>
565  <td><code>-useaudio</code></td>
566  <td>Enable audio support in the current emulator instance.</td>
567  <td>Enabled by default. </td>
568</tr>
569
570<tr>
571  <td rowspan="7">Network</td>
572  <td><code>-dns-server &lt;servers&gt;</code></td>
573  <td>Use the specified DNS server(s). </td>
574  <td>The value of <code>&lt;servers&gt;</code> must be a comma-separated list of up to 4 DNS server names or
575  IP addresses.</td>
576</tr>
577<tr>
578  <td><code>-http-proxy &lt;proxy&gt;</code></td>
579  <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td>
580  <td>The value of <code>&lt;proxy&gt;</code> can be one of the following:<br>
581     <code>http://&lt;server&gt;:&lt;port&gt;</code><br>
582     <code>http://&lt;username&gt;:&lt;password&gt;@&lt;server&gt;:&lt;port&gt;</code>
583  <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy &lt;proxy&gt;</code> command is not supplied,
584  the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching
585  the <code>&lt;proxy&gt;</code> format described above.</p></td>
586</tr>
587<tr>
588  <td><code>-netdelay &lt;delay&gt;</code></td>
589  <td>Set network latency emulation to &lt;delay&gt;.</td>
590  <td>Default value is <code>none</code>. See the table in <a href="#netdelay">Network Delay Emulation</a> for
591  supported <code>&lt;delay&gt;</code> values. </td>
592</tr>
593<tr>
594  <td><code>-netfast</code></td>
595  <td>Shortcut for <code>-netspeed full -netdelay none</code></td>
596  <td>&nbsp;</td></tr>
597<tr>
598  <td><code>-netspeed &lt;speed&gt;</code></td>
599  <td>Set network speed emulation to &lt;speed&gt;.</td>
600  <td>Default value is <code>full</code>. See the table in <a href="#netspeed">Network Speed Emulation</a> for
601  supported <code>&lt;speed&gt;</code> values. </td>
602</tr>
603<tr>
604  <td><code>-port &lt;port&gt;</code></td>
605  <td>Set the console port number for this emulator instance to <code>&lt;port&gt;</code>.</td>
606  <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code>&lt;port&gt;</code>+1
607  must also be free and will be reserved for ADB.</td>
608</tr>
609<tr>
610  <td><code>-report-console &lt;socket&gt;</code></td>
611  <td>Report the assigned console port for this emulator instance to a remote third party
612  before starting the emulation. </td>
613  <td><code>&lt;socket&gt;</code> must use one of these formats:
614
615<p><code>tcp:&lt;port&gt;[,server][,max=&lt;seconds&gt;]</code></br>
616<code>unix:&lt;port&gt;[,server][,max=&lt;seconds&gt;]</code></p>
617
618<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td>
619</tr>
620<tr>
621  <td rowspan="8">System</td>
622  <td><code>-cpu-delay &lt;delay&gt;</code></td>
623  <td>Slow down emulated CPU speed by &lt;delay&gt; </td>
624  <td>Supported values for &lt;delay&gt; are integers between 0 and 1000.
625
626<p>Note that the &lt;delay&gt; does not correlate to clock speed or other absolute metrics
627&mdash; it simply represents an abstract, relative delay factor applied non-deterministically
628in the emulator. Effective performance does not always
629scale in direct relationship with &lt;delay&gt; values.</p>
630</td>
631</tr>
632<tr>
633  <td><code>-gps &lt;device&gt;</code></td>
634  <td>Redirect NMEA GPS to character device.</td>
635  <td>Use this command to emulate an NMEA-compatible GPS unit connected to
636  an external character device or socket. The format of <code>&lt;device&gt;</code> must be QEMU-specific
637  serial device specification. See the documentation for 'serial -dev' at
638  <a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
639</td>
640</tr>
641<tr>
642  <td><code>-nojni</code></td>
643  <td>Disable JNI checks in the Dalvik runtime.</td><td>&nbsp;</td></tr>
644<tr>
645  <td><code>-qemu</code></td>
646  <td>Pass arguments to qemu.</td>
647  <td>&nbsp;</td></tr>
648<tr>
649  <td><code>-qemu -h</code></td>
650  <td>Display qemu help.</td>
651  <td></td></tr>
652<tr>
653  <td><code>-radio &lt;device&gt;</code></td>
654  <td>Redirect radio mode to the specified character device.</td>
655  <td>The format of <code>&lt;device&gt;</code> must be QEMU-specific
656  serial device specification. See the documentation for 'serial -dev' at
657<a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
658</td>
659</tr>
660<tr>
661 <td><code>-timezone &lt;timezone&gt;</code></td>
662 <td>Set the timezone for the emulated device to &lt;timezone&gt;, instead of the host's timezone.</td>
663 <td><code>&lt;timezone&gt;</code> must be specified in zoneinfo format. For example:
664<p>"America/Los_Angeles"<br>
665"Europe/Paris"</p>
666</td>
667</tr>
668<tr>
669 <td><code>-version</code></td>
670 <td>Display the emulator's version number.</td>
671 <td>&nbsp;</td>
672</tr>
673<tr>
674  <td rowspan="12">UI</td>
675  <td><code>-dpi-device &lt;dpi&gt;</code></td>
676  <td>Scale the resolution of the emulator to match the screen size
677  of a physical device.</td>
678  <td>The default value is 165. See also <code>-scale</code>.</td>
679</tr>
680<tr>
681  <td><code>-no-boot-anim</code></td>
682  <td>Disable the boot animation during emulator startup.</td>
683  <td>Disabling the boot animation can speed the startup time for the emulator.</td>
684</tr>
685<tr>
686  <td><code>-no-window</code></td>
687  <td>Disable the emulator's graphical window display.</td>
688  <td>&nbsp;</td>
689</tr>
690<tr>
691  <td><code>-scale &lt;scale&gt;</code></td>
692  <td>Scale the emulator window. </td>
693  <td><code>&lt;scale&gt;</code> is a number between 0.1 and 3 that represents the desired scaling factor. You can
694  also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
695  tells the emulator to select the best window size.</td>
696</tr>
697<tr>
698  <td><code>-raw-keys</code></td>
699  <td>Disable Unicode keyboard reverse-mapping.</td>
700  <td>&nbsp;</td></tr>
701<tr>
702  <td><code>-noskin</code></td>
703  <td>Don't use any emulator skin.</td>
704  <td>&nbsp;</td></tr>
705<tr>
706  <td><code>-keyset &lt;file&gt;</code></td>
707  <td>Use the specified keyset file instead of the default.</td>
708  <td>The keyset file defines the list of key bindings between the emulator and the host keyboard.
709  For more information, use <code>-help-keyset</code> to print information about this topic.
710</td>
711</tr>
712<tr>
713  <td><code>-onion &lt;image&gt;</code></td>
714  <td>Use overlay image over screen.</td>
715  <td>No support for JPEG. Only PNG is supported.</td></tr>
716<tr>
717  <td><code>-onion-alpha &lt;percent&gt;</code></td>
718  <td>Specify onion skin translucency  value (as percent).
719  <td>Default is 50.</td>
720</tr>
721<tr>
722  <td><code>-onion-rotation &lt;position&gt;</code></td>
723  <td>Specify onion skin rotation.
724  <td><code>&lt;position&gt;</code> must be one of the values 0, 1, 2, 3.</td>
725</tr>
726<tr>
727  <td><code>-skin &lt;skinID&gt;</code></td>
728  <td>This emulator option is deprecated. </td>
729  <td>Please set skin options using AVDs, rather than by using this emulator
730option. Using this option may yield unexpected and in some cases misleading
731results, since the density with which to render the skin may not be defined.
732AVDs let you associate each skin with a default density and override the default
733as needed. For more information, see <a
734href="{@docRoot}guide/developing/tools/avd.html">Android Virtual Devices</a>.
735</td>
736</tr>
737<tr>
738  <td><code>-skindir &lt;dir&gt;</code></td>
739  <td>This emulator option is deprecated. </td>
740  <td>See comments for <code>-skin</code>, above.</td></tr>
741</table>
742
743<a name="diskimages"></a>
744
745<h2>Working with Emulator Disk Images</h2>
746
747<p>The emulator uses mountable disk images stored on your development machine to
748simulate flash (or similar) partitions on an actual device. For example, it uses
749disk image containing an emulator-specific kernel, the Android system, a
750ramdisk image, and writeable images for user data and simulated SD card.</p>
751
752<p>To run properly, the emulator requires access to a specific set of disk image
753files. By default, the Emulator always looks for the disk images in the
754private storage area of the AVD in use. If no images exist there when
755the Emulator is launched, it creates the images in the AVD directory based on
756default versions stored in the SDK. </p>
757
758<p class="note"><strong>Note:</strong> The default storage location for
759AVDs is in <code>~/.android/avd</code> on OS X and Linux, <code>C:\Documents and
760Settings\&lt;user&gt;\.android\</code> on Windows XP, and
761<code>C:\Users\&lt;user&gt;\.android\</code>
762on Windows Vista.</p>
763
764<p>To let you use alternate or custom versions of the image files, the emulator
765provides startup options that override the default locations and filenames of
766the image files. When you use the options, the emulator searches for the image
767file under the image name or location that you specify; if it can not locate the
768image, it reverts to using the default names and location.</p>
769
770<p>The emulator uses three types of image files: default image files, runtime
771image files, and temporary image files. The sections below describe how to
772override the location/name of each type of file. </p>
773
774<a name="defaultimages"></a>
775<h3>Default Images</h3>
776
777<p>When the emulator launches but does not find an existing user data image in
778the active AVD's storage area, it creates a new one from a default version
779included in the SDK. The default user data image is read-only. The image
780files are read-only.</p>
781
782<p>The emulator provides the <code>-system &lt;dir&gt;</code> startup option to
783let you override the location under which the emulator looks for the default
784user data image. </p>
785
786<p>The emulator also provides a startup option that lets you override the name
787of the default user data image, as described in the table below. When you use the
788option, the emulator looks in the default directory, or in a custom location
789(if you specified <code>-system &lt;dir&gt;</code>). </p>
790
791
792<table>
793<tr>
794  <th width="10%" >Name</th>
795    <th width="30%" >Description</th>
796    <th width="40%" >Comments</th>
797</tr>
798
799<!--
800<tr>
801  <td><code>kernel-qemu.img</code></td>
802  <td>The emulator-specific Linux kernel image</td>
803  <td>Override using <code>-kernel &lt;file&gt;</code></td>
804</tr>
805
806<tr>
807  <td><code>ramdisk.img</code></td>
808  <td>The ramdisk image used to boot the system.</td>
809  <td>Override using <code>-ramdisk &lt;file&gt;</code></td>
810</tr>
811
812<tr>
813  <td><code>system.img</code></td>
814  <td>The <em>initial</em> Android system image.</td>
815  <td>Override using <code>-image &lt;file&gt;</code></td>
816</tr>
817-->
818<tr>
819  <td><code>userdata.img</code></td>
820  <td>The <em>initial</em> user-data disk image</td>
821  <td>Override using <code>-initdata &lt;file&gt;</code>. Also see
822<code>-data &lt;file&gt;</code>, below.</td>
823</tr>
824
825</table>
826
827<a name="runtimeimages"></a>
828<h3>Runtime Images: User Data and SD Card</h3>
829
830<p>At runtime, the emulator reads and writes data on two disk images: a
831user-data image and (optionally) an SD card image. This emulates the user-data
832partition and removable storage media on actual device. </p>
833
834<p>The emulator provides a default user-data disk image. At startup, the emulator
835creates the default image as a copy of the system user-data image (user-data.img),
836described above. The emulator stores the new image with the files of the active AVD.</p>
837
838<!--
839<p>The emulator provides a startup option, <code>-datadir &lt;dir&gt;</code>,
840that you can use to override the location under which the emulator looks for the runtime
841image files. </p>
842-->
843
844<p>The emulator provides startup options to let you override the actual names and storage
845locations of the runtime images to load, as described in the table below. When you use one
846of these options, the emulator looks for the specified file(s) in the current working directory,
847in the AVD directory, or in a custom location (if you specified a path with the filename). </p>
848
849<table>
850<tr>
851  <th width="10%" >Name</th>
852    <th width="30%" >Description</th>
853    <th width="40%" >Comments</th>
854</tr>
855<tr>
856  <td><code>userdata-qemu.img</code></td>
857  <td>An image to which the emulator writes runtime user-data for a unique user.</td>
858  <td>Override using <code>-data &lt;filepath&gt;</code>, where <code>&lt;filepath&gt;</code> is the
859path the image, relative to the current working directory. If you supply a filename only,
860the emulator looks for the file in the current working directory. If the file at <code>&lt;filepath&gt;</code> does
861not exist, the emulator creates an image from the default userdata.img, stores it under the name you
862specified, and persists user data to it at shutdown. </td>
863</tr>
864
865<tr>
866  <td><code>sdcard.img</code></td>
867  <td>An image representing an SD card inserted into the emulated device.</td>
868  <td>Override using <code>-sdcard &lt;filepath&gt;</code>, where <code>&lt;filepath&gt;</code> is the
869path the image, relative to the current working directory. If you supply a filename only,
870the emulator looks for the file in the current working directory. </td>
871</tr>
872
873</table>
874
875<h4>User-Data Image</h4>
876
877<p>Each emulator instance uses a writeable user-data image to store user- and
878session-specific data. For example, it uses the image to store a unique user's
879installed application data, settings, databases, and files. </p>
880
881<p>At startup, the emulator attempts to load a user-data image stored during
882a previous session. It looks for the file in the current working directory,
883in the AVD directory as described above, and at the custom location/name
884that you specified at startup. </p>
885
886<ul>
887<li>If it finds a user-data image, it mounts the image and makes it available
888to the system for reading/writing of user data. </li>
889<li>If it does not find one, it creates an image by copying the system user-data
890image (userdata.img), described above. At device power-off, the system persists
891the user data to the image, so that it will be available in the next session.
892Note that the emulator stores the new disk image at the location/name that you
893specify in <code>-data</code> startup option.</li>
894</ul>
895
896<p class="note"><strong>Note:</strong> Because of the AVD configurations used in the emulator,
897each emulator instance now gets its own dedicated storage. There is no need
898to use the <code>-d</code> option to specify an instance-specific storage area.</p>
899
900<h4>SD Card</h4>
901
902<P>Optionally, you can create a writeable disk image that the emulator can use
903to simulate removeable storage in an actual device. For information about how to create an
904emulated SD card and load it in the emulator, see <a href="#sdcard">SD Card Emulation</a></p>
905
906<p>You can also use the android tool to automatically create an SD Card image
907for you, when creating an AVD. For more information, see <a
908href="{@docRoot}guide/developing/tools/avd.html#options">Command-line options for AVDs</a>.
909
910<a name="temporaryimages"></a>
911<h3>Temporary Images</h3>
912
913<p>The emulator creates two writeable images at startup that it deletes at
914device power-off. The images are: </p>
915
916<ul>
917  <li>A writable copy of the Android system image</li>
918  <li>The <code>/cache</code> partition image</li>
919</ul>
920
921<p>The emulator does not permit renaming the temporary system image or
922persisting it at device power-off. </p>
923
924<p>The <code>/cache</code> partition image is initially empty, and is used by
925the browser to cache downloaded web pages and images. The emulator provides an
926<code>-cache &lt;file&gt;</code>, which specifies the name of the file at which
927to persist the <code>/cache</code> image at device power-off. If <code>&lt;file&gt;
928</code> does not exist, the emulator creates it as an empty file. </p>
929
930<p>You can also disable the use of the cache partition by specifying the
931<code>-nocache</code> option at startup. </p>
932
933
934<a name="emulatornetworking"></a>
935<h2>Emulator Networking</h2>
936
937<p>The emulator provides versatile networking capabilities that you can use to
938set up complex modeling and testing environments for your application. The
939sections below introduce the emulator's network architecture and capabilities.
940</p>
941
942<a name="networkaddresses"></a>
943<h3>Network Address Space</h3>
944
945<p>Each instance of the emulator runs behind a virtual router/firewall service
946that isolates it from your development machine's network interfaces and settings
947and from the internet. An emulated device can not see your development machine
948or other emulator instances on the network. Instead, it sees only that it is
949connected through Ethernet to a router/firewall.</p>
950
951<p>The virtual router for each instance manages the 10.0.2/24 network address
952space &mdash; all addresses managed by the router are in the form of
95310.0.2.&lt;xx&gt;, where &lt;xx&gt; is a number. Addresses within this space are
954pre-allocated by the emulator/router as follows:</p>
955
956<table>
957  <tr>
958    <th>Network Address</th>
959    <th>Description</th>
960  </tr>
961  <tr>
962    <td>10.0.2.1</td>
963    <td>Router/gateway address </td>
964  </tr>
965  <tr>
966    <td>10.0.2.2</td>
967    <td>Special alias to your host loopback interface (i.e., 127.0.0.1 on your
968development machine)</td>
969  </tr>
970  <tr>
971    <td>10.0.2.3</td>
972    <td>First DNS server</td>
973  </tr>
974  <tr>
975    <td>10.0.2.4 / 10.0.2.5 / 10.0.2.6</td>
976    <td>Optional second, third and fourth DNS server (if any) </td>
977  </tr>
978  <tr>
979    <td>10.0.2.15</td>
980    <td>The emulated device's own network/ethernet interface</td>
981  </tr>
982  <tr>
983    <td>127.0.0.1</td>
984    <td>The emulated device's own loopback interface </td>
985  </tr>
986</table>
987
988<p>Note that the same address assignments are used by all running emulator
989instances. That means that if you have two instances running concurrently on
990your machine, each will have its own router and, behind that, each will have an
991IP address of 10.0.2.15. The instances are isolated by a router and can
992<em>not</em> see each other on the same network. For information about how to
993let emulator instances communicate over TCP/UDP, see <a
994href="#connecting">Connecting Emulator Instances</a>.</p>
995
996<p>Also note that the address 127.0.0.1 on your development machine corresponds
997to the emulator's own loopback interface. If you want to access services running
998on your development machine's loopback interface (a.k.a. 127.0.0.1 on your
999machine), you should use the special address 10.0.2.2 instead.</p>
1000
1001<p>Finally, note that each emulated device's pre-allocated addresses are
1002specific to the Android emulator and will probably be very different on real
1003devices (which are also very likely to be NAT-ed, i.e., behind a
1004router/firewall)</p>
1005
1006<a name="networkinglimitations"></a>
1007<h3>Local Networking Limitations</h3>
1008
1009<p>Each emulator instance runs behind a virtual router, but unlike an actual
1010device connected to a physical router, the emulated device doesn't have access
1011to a physical network. Instead it runs as part of a normal application on your
1012development machine. This means that it is subject to the same networking
1013limitations as other applications on your machine:</p>
1014
1015<ul>
1016  <li>Communication with the emulated device may be blocked by a firewall
1017program running on your machine.</li>
1018  <li>Communication with the emulated device may be blocked by another
1019(physical) firewall/router to which your machine is connected.</li>
1020</ul>
1021
1022<p>The emulator's virtual router should be able to handle all outbound TCP and
1023UDP connections/messages on behalf of the emulated device, provided your
1024development machine's network environment allows it to do so. There are no
1025built-in limitations on port numbers or ranges except the one imposed by your
1026host operating system and network.</p>
1027
1028<p>Depending on the environment, the emulator may not be able to support other
1029protocols (such as ICMP, used for "ping") might not be supported. Currently, the
1030emulator does not support IGMP or multicast. </p>
1031
1032<a name="redirections"></a>
1033<h3>Using Network Redirections</h3>
1034
1035<p>To communicate with an emulator instance behind its virtual router, you need
1036to set up network redirections on the virtual router. Clients can then connect
1037to a specified guest port on the router, while the router directs traffic
1038to/from that port to the emulated device's host port. </p>
1039
1040<p>To set up the network redirections, you create a mapping of host and guest
1041ports/addresses on the the emulator instance. There are two ways to set up
1042network redirections: using emulator console commands and using the ADB tool, as
1043described below. </p>
1044
1045<a name="consoleredir"></a>
1046<h4>Setting up Redirections through the Emulator Console</h4>
1047
1048<p>Each emulator instance provides a control console the you can connect to, to
1049issue commands that are specific to that instance. You can use the
1050<code>redir</code> console command to set up redirections as needed for an
1051emulator instance. </p>
1052
1053<p>First, determine the console port number for the target emulator instance.
1054For example, the console port number for the first emulator instance launched is
10555554. Next, connect to the console of the target emulator instance, specifying
1056its console port number, as follows: </p>
1057
1058<pre><code>telnet localhost 5554</code></pre>
1059
1060<p>Once connected, use the <code>redir</code> command to work with redirections.
1061To add a redirection, use:</a>. </p>
1062
1063<pre><code>add&nbsp;&lt;protocol&gt;:&lt;host-port&gt;:&lt;guest-port&gt;</code>
1064</pre>
1065
1066<p>where <code>&lt;protocol&gt;</code> is either <code>tcp</code> or <code>udp</code>,
1067and <code>&lt;host-port&gt;</code> and <code>&lt;guest-port&gt;</code> sets the
1068mapping between your own machine and the emulated system, respectively. </p>
1069
1070<p>For example, the following command sets up a redirection that will handle all
1071incoming TCP connections to your host (development) machine on 127.0.0.1:5000
1072and will pass them through to the emulated system's 10.0.2.15:6000.:</p>
1073
1074<pre>redir add tcp:5000:6000</pre>
1075
1076<p>To delete a redirection, you can use the <code>redir del</code> command. To
1077list all redirections for a specific instance, you can use <code>redir
1078list</code>. For more information about these and other console commands, see
1079<a href="#console">Using the Emulator Console</a>. </p>
1080
1081<p>Note that port numbers are restricted by your local environment. this typically
1082means that you cannot use host port numbers under 1024 without special
1083administrator privileges.  Also, you won't be able to set up a redirection for a
1084host port that is already in use by another process on your machine. In that
1085case, <code>redir</code> generates an error message to that effect. </p>
1086
1087<a name="adbredir"></a>
1088<h4>Setting Up Redirections through ADB</h4>
1089
1090<p>The Android Debug Bridge (ADB) tool provides port forwarding, an alternate
1091way for you to set up network redirections. For more information, see <a
1092href="{@docRoot}guide/developing/tools/adb.html#forwardports">Forwarding Ports</a> in the ADB
1093documentation.</p>
1094
1095<p>Note that ADB does not currently offer any way to remove a redirection,
1096except by killing the ADB server.</p>
1097
1098<a name="dns"></a>
1099<h3>Configuring the Emulator's DNS Settings</h3>
1100
1101<p>At startup, the emulator reads the list of DNS servers that your system is
1102currently using. It then stores the IP addresses of up to four servers on this
1103list and sets up aliases to them on the emulated addresses 10.0.2.3, 10.0.2.4,
110410.0.2.5 and 10.0.2.6 as needed.  </p>
1105
1106<p>On Linux and OS X, the emulator obtains the DNS server addresses by parsing
1107the file <code>/etc/resolv.conf</code>. On Windows, the emulator obtains the
1108addresses by calling the <code>GetNetworkParams()</code> API. Note that this
1109usually means that the emulator ignores the content of your "hosts" file
1110(<code>/etc/hosts</code> on Linux/OS X, <code>%WINDOWS%/system32/HOSTS</code>
1111 on Windows).</P>
1112
1113<p>When starting the emulator at the command line, you can also use the
1114<code>-dns-server &lt;serverList&gt;</code> option to manually specify the
1115addresses of DNS servers to use, where &lt;serverList&gt; is a comma-separated
1116list of server names or IP addresses. You might find this option useful if you
1117encounter DNS resolution problems in the emulated network (for example, an
1118"Unknown Host error" message that appears when using the web browser).</p>
1119
1120<a name="proxy"></a>
1121<h3>Using the Emulator with a Proxy</h3>
1122
1123<p>If your emulator must access the Internet through a proxy server, you can use
1124the <code>-http-proxy &lt;proxy&gt;</code> option when starting the emulator, to
1125set up the appropriate redirection. In this case, you specify proxy information
1126in <code>&lt;proxy&gt;</code> in one of these formats:</p>
1127
1128<pre>http://&lt;machineName&gt;:&lt;port&gt;</pre>
1129
1130<p>or</p>
1131
1132<pre>http://&lt;username&gt;:&lt;password&gt;@&lt;machineName&gt;:&lt;port&gt;</pre>
1133
1134<p>The <code>-http-proxy</code> option forces the emulator to use the specified
1135HTTP/HTTPS proxy for all outgoing TCP connections. Redirection for UDP is not
1136currently supported.</p>
1137
1138<p>Alternatively, you can define the environment variable
1139<code>http_proxy</code> to the value you want to use for
1140<code>&lt;proxy&gt;</code>. In this case, you do not need to specify a value for
1141<code>&lt;proxy&gt;</code> in the <code>-http-proxy</code> command &mdash; the
1142emulator checks the value of the <code>http_proxy</code> environment variable at
1143startup and uses its value automatically, if defined. </p>
1144
1145<p>You can use the <code>-debug-proxy</code> option to diagnose proxy
1146connection problems.</p>
1147
1148<a name="connecting"></a>
1149<h3>Interconnecting Emulator Instances</h3>
1150
1151<p>To allow one emulator instance to communicate with another, you must set up
1152the necessary network redirections as illustrated below. </p>
1153
1154<p>Assume that your environment is</p>
1155
1156<ul>
1157  <li>A is you development machine</li>
1158  <li>B is your first emulator instance, running on A</li>
1159  <li>C is your second emulator instance, running on A too</li>
1160</ul>
1161
1162<p>and you want to run a server on B, to which C will connect, here is how you
1163could set it up: </p>
1164
1165<ol>
1166  <li>Set up the server on B, listening to
1167<code>10.0.2.15:&lt;serverPort&gt;</code></li>
1168  <li>On B's console, set up a redirection from
1169<code>A:localhost:&lt;localPort&gt;</code> to <code>
1170B:10.0.2.15:&lt;serverPort&gt;</code></li>
1171  <li>On C, have the client connect to 10.0.2.2:&lt;localPort&gt;</code></li>
1172</ol>
1173
1174<p>For example, if you wanted to run an HTTP server, you can select
1175<code>&lt;serverPort&gt;</code> as 80 and <code>&lt;localPort&gt;</code> as
11768080:</p>
1177
1178<ul>
1179  <li>B listens on 10.0.2.15:80</li>
1180  <li>On B's console, issue <code>redir add tcp:8080:80</code></li>
1181  <li>C connects to 10.0.2.2:8080</li>
1182</ul>
1183
1184<a name="calling"></a>
1185<h3>Sending a Voice Call or SMS to Another Emulator Instance</h3>
1186
1187<p>The emulator automatically forwards simulated voice calls and SMS messages from one instance to another. To send a voice call or SMS, you use the dialer application and SMS application (if available) installed on one emulator </p>
1188
1189<p>To initiate a simulated voice call to another emulator instance:</p>
1190<ol>
1191<li>Launch the dialer application on the originating emulator instance.</li>
1192<li>As the number to dial, enter the console port number of the instance you'd like to call. You can determine
1193  the console port number of the target instance by checking its window title, where the
1194  console port number is reported as "Android Emulator (&lt;port&gt;). </li>
1195<li>Press "Dial". A new inbound call appears in the target emulator instance. </li>
1196</ol>
1197
1198<p>To send an SMS message to another emulator instance, launch the SMS application (if available). Specify the console port number of the target emulator instance as as the SMS address, enter the message text, and send the message. The message is delivered to the target emulator instance. </p>
1199
1200<p>You can also connect to an emulator instance's console to simulate an incoming voice call or SMS. For more information, see <a href="#telephony">Telephony Emulation</a> and <a href="#sms">SMS Emulation</a>.
1201
1202<a name="console"></a>
1203
1204<h2>Using the Emulator Console</h2>
1205
1206<p>Each running emulator instance includes a console facility that lets you dynamically query and control the simulated device environment. For example, you can use the console to dynamically manage port redirections and network characteristics and simulate telephony events. To access the console and enter commands, you use telnet to connect to the console's port number. </p>
1207<p>To connect to the console of any running emulator instance at any time, use this command: </p>
1208
1209<pre>telnet localhost &lt;console-port&gt;</pre>
1210
1211<p>An emulator instance occupies a pair of adjacent ports: a console port and an adb port. The port numbers differ by 1, with the adb port having the higher port number. The console of the first emulator instance running on a given machine uses console port 5554 and adb port 5555. Subsequent instances use port numbers increasing by two &mdash; for example, 5556/5557, 5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility. </p>
1212
1213<p>To connect to the emulator console, you must specify a valid console port. If multiple emulator instances are running, you need to determine the console port of the emulator instance you want to connect to. You can find the instance's console port listed in the title of the instance window. For example, here's the window title for an instance whose console port is 5554:</p>
1214
1215<p><code>Android Emulator (5554)</code></p>
1216
1217<p>Alternatively, you can use the <code>adb devices</code> command, which prints a list of running emulator instances and their console port numbers. For more information, see <a href="{@docRoot}guide/developing/tools/adb.html#devicestatus">Querying for Emulator/Device Instances</a> in the adb documentation.</p>
1218
1219<p class="note">Note: The emulator listens for connections on ports 5554-5587 and accepts connections only from localhost.</p>
1220
1221<p>Once you are connected to the console, you can then enter <code>help [command]</code> to see a list of console commands and learn about specific commands. </p>
1222
1223<p>To exit the console session, use <code>quit</code> or <code>exit</code>.</p>
1224
1225<p>The sections below describe the major functional areas of the console.</p>
1226
1227<a name="portredirection"></a>
1228
1229<h3>Port Redirection</h3>
1230<p>You can use the console to add and remove port redirections while the emulator is running. After connecting to the console, you can manage port redirections in this way:</p>
1231<pre>redir &lt;list|add|del&gt; </pre>
1232
1233<p>The <code>redir</code> command supports the subcommands listed in the table below. </p>
1234
1235<table>
1236<tr>
1237  <th width="25%" >Subcommand
1238  <th width="30%" >Description</th>
1239  <th width="35%">Comments</th>
1240</tr>
1241
1242  <tr>
1243    <td><code>list</code></td>
1244    <td>List the current port redirections.</td>
1245  <td>&nbsp;</td>
1246  </tr>
1247
1248
1249<tr>
1250 <td><code>add&nbsp;&lt;protocol&gt;:&lt;host-port&gt;:&lt;guest-port&gt;</code></td>
1251  <td>Add a new port redirection.</td>
1252<td><li>&lt;protocol&gt; must be either &quot;tcp&quot; or &quot;udp&quot;</li>
1253<li>&lt;host-port&gt; is the port number to open on the host</li>
1254<li>&lt;guest-port&gt; is the port number to route data to on the emulator/device</li></td>
1255</tr>
1256<tr>
1257  <td><code>del &lt;protocol&gt;:&lt;host-port&gt;</code></td>
1258  <td>Delete a port redirection.</td>
1259<td>See above for meanings of &lt;protocol&gt; and &lt;host-port&gt;.</td>
1260</tr>
1261</table>
1262
1263<a name="geo"></a>
1264<h3>Geo Location Provider Emulation</h3>
1265
1266<p>The console provides commands to let you set the geo position used by an emulator emulated device. You can use the <code>geo</code> command to send a simple GPS fix to the emulator, without needing to use NMEA 1083 formatting. The usage for the command is: </p>
1267
1268<pre>geo &lt;fix|nmea&gt;</pre>
1269
1270<p>The <code>geo</code> command supports the subcommands listed in the table below. </p>
1271
1272<table>
1273<tr>
1274  <th width="25%" >Subcommand
1275  <th width="30%" >Description</th>
1276  <th width="35%">Comments</th>
1277</tr>
1278
1279  <tr>
1280    <td><code>fix &lt;longitude&gt; &lt;latitude&gt; [&lt;altitude&gt;]</code></td>
1281    <td>Send a simple GPS fix to the emulator instance.</td>
1282  <td>Specify longitude and latitude in decimal degrees. Specify altitude in meters.</td>
1283  </tr>
1284<tr>
1285  <td><code>nmea &lt;sentence&gt;</code></td>
1286  <td>Send an NMEA 0183 sentence to the emulated device, as if it were sent from an emulated GPS modem.</td>
1287<td><code>&lt;sentence&gt;</code> must begin with '$GP'. Only '$GPGGA' and '$GPRCM' sentences are currently supported.</td>
1288</tr>
1289</table>
1290
1291<p>You can issue the <code>geo</code> command to fix the GPS location as soon as an emulator instance is running. The emulator creates a mock location provider that sends it to GPS-aware applications as soon as they start and register location listeners. Any application can query the location manager to obtain the current GPS fix for the emulated device by calling:
1292
1293<pre>LocationManager.getLastKnownLocation("gps")</pre>
1294
1295<p>For more information about the Location Manager, see {@link android.location.LocationManager} and its methods.</p>
1296
1297<a name="events"></a>
1298<h3>Hardware Events Emulation</h3>
1299
1300<p>You can use the <code>event</code> command to send various events to the emulator.The usage for the command is: </p>
1301
1302<pre>event &lt;send|types|codes|text&gt;</pre>
1303
1304<p>The <code>event</code> command supports the subcommands listed in the table below. </p>
1305
1306<table>
1307<tr>
1308  <th width="25	%" >Subcommand
1309  <th width="30%" >Description</th>
1310  <th width="35%">Comments</th>
1311</tr>
1312
1313  <tr>
1314    <td><code>send &lt;type&gt;:&lt;code&gt;:&lt;value&gt; [...]</code></td>
1315    <td>Send one or more events to the Android kernel. </td>
1316  <td>You can use text names or integers for <code>&lt;type&gt;</code> and <code>&lt;value&gt;</code>.</td>
1317  </tr>
1318<tr>
1319  <td><code>types</code></td>
1320  <td>List all <code>&lt;type&gt;</code> string aliases supported by the <code>event</code> subcommands.</td>
1321<td>&nbsp;</td>
1322</tr>
1323<tr>
1324  <td><code>codes &lt;type&gt;</code></td>
1325  <td>List all <code>&lt;codes&gt;</code> string aliases supported by the <code>event</code>
1326   subcommands for the specified <code>&lt;type&gt;</code>.</td>
1327<td>&nbsp;</td>
1328</tr>
1329<tr>
1330  <td><code>event text &lt;message&gt;</code></td>
1331  <td>Simulate keypresses to send the specified string of characters as a message,</td>
1332<td>The message must be a UTF-8 string. Unicode posts will be reverse-mapped according to the current device keyboard. Unsupported characters will be discarded silently.</td>
1333</tr>
1334</table>
1335
1336<a name="power"></a>
1337<h3>Device Power Characteristics</h3>
1338
1339<p>You can use the <code>power</code> command to control the simulated power state of the emulator instance.The usage for the command is: </p>
1340
1341<pre>power &lt;display|ac|status|present|health|capacity&gt;</pre>
1342
1343<p>The <code>event</code> command supports the subcommands listed in the table below. </p>
1344
1345<table>
1346<tr>
1347  <th width="25	%" >Subcommand
1348  <th width="30%" >Description</th>
1349  <th width="35%">Comments</th>
1350</tr>
1351
1352  <tr>
1353    <td><code>display</code></td>
1354    <td>Display battery and charger state.</td>
1355  <td>&nbsp;</td>
1356  </tr>
1357<tr>
1358  <td><code>ac &lt;on|off&gt;</code></td>
1359  <td>Set AC charging state to on or off. </td>
1360<td>&nbsp;</td>
1361</tr>
1362<tr>
1363  <td><code>status &lt;unknown|charging|discharging|not-charging|full&gt;</code></td>
1364  <td>Change battery status as specified.</td>
1365<td>&nbsp;</td>
1366</tr>
1367
1368<tr>
1369  <td><code>present &lt;true|false&gt;</code></td>
1370  <td>Set battery presence state.</td>
1371<td>&nbsp;</td>
1372</tr>
1373<tr>
1374  <td><code>health &lt;unknown|good|overheat|dead|overvoltage|failure&gt;</code></td>
1375  <td>Set battery health state.</td>
1376<td>&nbsp;</td>
1377</tr>
1378<tr>
1379  <td><code>power health &lt;percent&gt;</code></td>
1380  <td>Set remaining battery capacity state (0-100).</td>
1381<td>&nbsp;</td>
1382</tr>
1383</table>
1384
1385<a name="netstatus"></a>
1386<h3>Network Status</h3>
1387
1388<p>You can use the console to check the network status and current delay and speed characteristics. To do so, connect to the console and use the <code>netstatus</code> command. Here's an example of the command and its output. </p>
1389
1390<pre>network status
1391</pre>
1392
1393<a name="netdelay"></a>
1394<h3>Network Delay Emulation</h3>
1395
1396<p>The emulator lets you simulate various network latency levels, so that you can test your application in an environment more typical of the actual conditions in which it will run. You can set a latency level or range at emulator startup or you can use the console to change the latency dynamically, while the application is running in the emulator. </p>
1397<p>To set latency at emulator startup, use the  <code>-netdelay</code> emulator option with a supported <code>&lt;delay&gt;</code> value, as listed in the table below. Here are some examples:</p>
1398<pre>emulator -netdelay gprs
1399emulator -netdelay 40 100</pre>
1400
1401<p>To make dynamic changes to  network delay while the emulator is running, connect to the console and use the <code>netdelay</code> command with a supported <code>&lt;delay&gt;</code> value from the table below.  </p>
1402
1403<pre>network delay gprs</pre>
1404
1405<p>The format of network <delay> is one of the following (numbers are milliseconds):</p>
1406
1407<table style="clear:right;width:100%;">
1408<tr>
1409  <th width="30%" >Value</td>
1410  <th width="35%" >Description</th><th width="35%">Comments</th></tr>
1411
1412  <tr><td><code>gprs</code></td><td>GPRS</td>
1413  <td>(min 150, max 550)</td>
1414  </tr>
1415
1416<tr><td><code>edge</code></td><td>EDGE/EGPRS</td>
1417<td>(min 80, max 400)</td>
1418</tr>
1419<tr><td><code>umts</code></td><td>UMTS/3G</td>
1420<td>(min 35, max 200)</td>
1421</tr>
1422<tr><td><code>none</code></td><td>No latency</td><td>(min 0, max 0)</td></tr>
1423<tr><td><code>&lt;num&gt;</code></td>
1424<td>Emulate an exact latency  (milliseconds).</td>
1425<td>&nbsp;</td></tr>
1426<tr><td><code>&lt;min&gt;:&lt;max&gt;</code></td>
1427<td>Emulate an specified latency range (min, max milliseconds).</td>
1428<td>&nbsp;</td></tr>
1429</table>
1430
1431<a name="netspeed"></a>
1432<h3>Network Speed Emulation</h3>
1433
1434<p>The emulator also lets you simulate various network transfer rates. You can set a transfer rate or range at emulator startup or you can use the console to change the rate dynamically, while the application is running in the emulator. </p>
1435<p>To set the network speed at emulator startup, use the  <code>-netspeed</code> emulator option with a supported <code>&lt;speed&gt;</code> value, as listed in the table below. Here are some examples:</p>
1436<pre>emulator -netspeed gsm
1437emulator -netspeed 14.4 80</pre>
1438
1439<p>To make dynamic changes to  network speed while the emulator is running, connect to the console and use the <code>netspeed</code> command with a supported <code>&lt;speed&gt;</code> value from the table below.  </p>
1440
1441<pre>network speed 14.4 80</pre>
1442
1443<p>The format of network <code>&lt;speed&gt;</code> is one of the following (numbers are
1444kilobits/sec):</p>
1445<table style="clear:right;width:100%;">
1446<tbody>
1447<tr>
1448  <th width="30%">Value</td>
1449  <th width="35%">Description</th><th width="35%">Comments</th></tr>
1450
1451  <tr>
1452  <td><code>gsm</code></td>
1453  <td>GSM/CSD</td><td>(Up: 14.4, down: 14.4)</td></tr>
1454<tr>
1455  <td><code>hscsd</code></td>
1456  <td>HSCSD</td><td>(Up: 14.4, down: 43.2)</td></tr>
1457<tr>
1458  <td><code>gprs</code></td>
1459  <td>GPRS</td><td>(Up: 40.0, down: 80.0)</td></tr>
1460<tr>
1461  <td><code>edge</code></td>
1462  <td>EDGE/EGPRS</td>
1463  <td>(Up: 118.4, down: 236.8)</td>
1464</tr>
1465<tr>
1466  <td><code>umts</code></td>
1467  <td>UMTS/3G</td><td>(Up: 128.0, down: 1920.0)</td></tr>
1468<tr>
1469  <td><code>hsdpa</code></td>
1470  <td>HSDPA</td><td>(Up: 348.0, down: 14400.0)</td></tr>
1471<tr>
1472  <td><code>full</code></td>
1473  <td>no limit</td><td>(Up: 0.0, down: 0.0)</td></tr>
1474<tr>
1475  <td><code>&lt;num&gt;</code></td>
1476  <td>Set an exact rate used for both upload and download.</td><td></td></tr>
1477<tr>
1478  <td><code>&lt;up&gt;:&lt;down&gt;</code></td>
1479  <td>Set exact rates for upload and download separately.</td><td></td></tr>
1480</table>
1481
1482
1483<a name="telephony"></a>
1484
1485<h3>Telephony Emulation</h3>
1486
1487<p>The Android emulator includes its own GSM emulated modem that lets you simulate telephony functions in the emulator. For example, you can simulate inbound phone calls and establish/terminate data connections. The Android system handles simulated calls exactly as it would actual calls. The emulator does not support call audio in this release. </p>
1488<p>You can use the console to access the emulator's telephony functions. After connecting to the console, you can use</p>
1489<pre>gsm &lt;call|accept|busy|cancel|data|hold|list|voice|status&gt; </pre>
1490<p>to invoke telephony functions. </p>
1491<p>The <code>gsm</code> command supports the subcommands listed in the table below. </p>
1492<table>
1493  <tr>
1494    <th >Subcommand </th>
1495    <th width="25%">Description</th>
1496    <th>Comments</th>
1497  </tr>
1498  <tr>
1499    <td><code>call &lt;phonenumber&gt;</code></td>
1500    <td>Simulate an inbound phone call from &lt;phonenumber&gt;.</td>
1501    <td>&nbsp;</td>
1502  </tr>
1503  <tr>
1504    <td><code>accept &lt;phonenumber&gt;</code></td>
1505    <td>Accept an inbound call from &lt;phonenumber&gt; and change the call's state "active".</td>
1506    <td>You can change a call's state to "active" only if its current state is "waiting" or "held".</td>
1507  </tr>
1508  <tr>
1509    <td><code>busy &lt;phonenumber&gt;</code></td>
1510    <td>Close an outbound call to &lt;phonenumber&gt; and change the call's state to "busy".</td>
1511    <td>You can change a call's state to "busy" only if its current state is "waiting".</td>
1512  </tr>
1513  <tr>
1514    <td><code>cancel &lt;phonenumber&gt;</code></td>
1515    <td>Terminate an inbound or outbound phone call to/from &lt;phonenumber&gt;.</td>
1516    <td>&nbsp;</td>
1517  </tr>
1518  <tr>
1519    <td><code>data &lt;state&gt;</code></td>
1520    <td>Change the state of the GPRS data connection to &lt;state&gt;.</td>
1521    <td>Supported &lt;state&gt; values are:<br />
1522          <li><code>unregistered</code> -- No network available</li>
1523          <li><code>home</code> -- On local network, non-roaming</li>
1524          <li><code>roaming</code> -- On roaming network</li>
1525          <li><code>searching</code> -- Searching networks</li>
1526          <li><code>denied</code> -- Emergency calls only</li>
1527          <li><code>off</code> -- Same as 'unregistered'</li>
1528      <li><code>on</code> -- same as 'home'</li>    </td>
1529  </tr>
1530  <tr>
1531    <td><code>hold</code></td>
1532    <td>Change the state of a call to "held". </td>
1533    <td>You can change a call's state to "held" only if its current state is	 "active" or "waiting". </td>
1534  </tr>
1535  <tr>
1536    <td><code>list</code></td>
1537    <td>List all inbound and outbound calls and their states.</td>
1538    <td>&nbsp;</td>
1539  </tr>
1540  <tr>
1541    <td><code>voice &lt;state&gt;</code></td>
1542    <td>Change the state of the GPRS voice connection to &lt;state&gt;.</td>
1543    <td>Supported &lt;state&gt; values are:<br />
1544    <li><code>unregistered</code> -- No network available</li>
1545    <li><code>home</code> -- On local network, non-roaming</li>
1546    <li><code>roaming</code> -- On roaming network</li>
1547    <li><code>searching</code> -- Searching networks</li>
1548    <li><code>denied</code> -- Emergency calls only</li>
1549    <li><code>off</code> -- Same as 'unregistered'</li>
1550    <li><code>on</code> -- Same as 'home'</li></td>
1551  </tr>
1552
1553  <tr>
1554    <td><code>status</code></td>
1555    <td>Report the current GSM voice/data state.</td>
1556    <td>Values are those described for the <code>voice</code> and <code>data</code> commands.</td>
1557  </tr>
1558</table>
1559
1560<a name="sms"></a>
1561
1562<h3>SMS Emulation</h3>
1563
1564<p>The Android emulator console lets you generate an SMS message and direct it to an emulator instance. Once you connect to an emulator instance, you can generate an emulated incoming SMS using this command:</p>
1565
1566<pre>sms send &lt;senderPhoneNumber&gt; &lt;textmessage&gt;</pre>
1567
1568<p>where <code>&lt;senderPhoneNumber&gt;</code> contains an arbitrary numeric string. </p>
1569
1570<p>The console forwards the SMS message to the Android framework, which passes it through to an application that handles that message type. </p>
1571
1572<a name="vm"></a>
1573
1574<h3>VM State</h3>
1575
1576<p>You can use the <code>vm</code> command to control the VM on an emulator instance.The usage for the command is: </p>
1577
1578<pre>vm &lt;start|stop|status&gt;</pre>
1579
1580<p>The <code>vm</code> command supports the subcommands listed in the table below. </p>
1581
1582<table>
1583<tr>
1584  <th width="25%" >Subcommand
1585  <th width="30%" >Description</th>
1586  <th width="35%">Comments</th>
1587</tr>
1588<tr>
1589    <td><code>start</code></td>
1590    <td>Start the VM on the instance. </td>
1591  <td>&nbsp;</td>
1592</tr>
1593<tr>
1594    <td><code>stop</code></td>
1595    <td>Stop the VM on the instance. </td>
1596  <td>&nbsp;</td>
1597</tr>
1598<tr>
1599    <td><code>start</code></td>
1600    <td>Display the current status of the VM (running or stopped). </td>
1601  <td>&nbsp;</td>
1602</tr>
1603</table>
1604
1605
1606<a name="window"></a>
1607
1608<h3>Emulator Window</h3>
1609
1610<p>You can use the <code>window</code> command to manage the emulator window. The usage for the command is: </p>
1611
1612<pre>window &lt;scale&gt;</pre>
1613
1614<p>The <code>vm</code> command supports the subcommands listed in the table below. </p>
1615
1616<table>
1617<tr>
1618  <th width="25%" >Subcommand
1619  <th width="30%" >Description</th>
1620  <th width="35%">Comments</th>
1621</tr>
1622<tr>
1623    <td><code>scale &lt;scale&gt;</code></td>
1624    <td>Scale the emulator window.</td>
1625  <td>&lt;scale&gt; must be a number between 0.1 and 3 that describes the desired scaling factor. You can
1626  also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
1627  tells the emulator to select the best window size.</td>
1628</tr>
1629</table>
1630
1631
1632<a name="terminating"></a>
1633
1634<h3>Terminating an Emulator Instance</h3>
1635
1636<p>You can terminate an emulator instance through the console, using the <code>kill</code> command.</p>
1637
1638
1639<a name="skins"></a>
1640
1641<h2>Using Emulator Skins</h2>
1642
1643<p>The Android SDK includes several Emulator skins that you can use to control the resolution and density of the emulated device's screen. To select a specific skin for running the emulator, create an AVD that uses that skin. Please do not use deprecated emulator options such as <code>-skin</code> to control the skin used by an emulator instance. For more information about AVDs, see <a
1644href="{@docRoot}guide/developing/tools/avd.html">Android Virtual Devices</a>.  </p>
1645
1646
1647<a name="multipleinstances"></a>
1648
1649<h2>Running Multiple Emulator Instances</h2>
1650
1651<p>Through the AVDs configurations used by the emulator, you can run multiple
1652instances of the emulator concurrently, each with its own AVD configuration and
1653storage area for user data, SD card, and so on. You no longer need to use the
1654<code>-d</code> option when launching the emulator, to point to an
1655instance-specific storage area. </p>
1656
1657<a name="apps"></a>
1658
1659<h2>Installing Applications on the Emulator</h2>
1660
1661<p>If you don't have access to Eclipse or the ADT Plugin, you can install
1662your application on the emulator <a href="{@docRoot}guide/developing/tools/adb.html#move">using
1663the adb utility</a>. Before installing the application, you need to package it
1664in a .apk file using the <a href="{@docRoot}guide/developing/tools/aapt.html">Android Asset Packaging Tool</a>.
1665Once the application is installed, you can start the emulator from the command
1666line, as described in this document, using any startup options necessary.
1667When the emulator is running, you can also connect to the emulator instance's
1668console to issue commands as needed.</p>
1669
1670<p>As you update your code, you periodically package and install it on the emulator.
1671The emulator preserves the application and its state data across restarts,
1672in a user-data disk partition. To ensure that the application runs properly
1673as you update it, you may need to delete the emulator's user-data partition.
1674To do so, start the emulator with the <code>-wipe-data</code> option.
1675For more information about the user-data partition and other emulator storage,
1676see <a href="#diskimages">Working with Emulator Disk Images</a>.</p>
1677
1678<a name="sdcard"></a>
1679<a name="creating"></a>
1680
1681<h2>SD Card Emulation</h2>
1682
1683<p>You can create a disk image and then load it to the emulator at startup, to
1684simulate the presence of a user's SD card in the device. To do this, you can use
1685the android tool to create a new SD card image with a new AVD, or you can use
1686the mksdcard utility included in the SDK. </p>
1687
1688<p>The sections below describe how to create an SD card disk image, how to copy
1689files to it, and how to load it in the emulator at startup. </p>
1690
1691<p>Note that you can only load disk image at emulator startup. Similarly, you
1692can not remove a simulated SD card from a running emulator. However, you can
1693browse, send files to, and copy/remove files from a simulated SD card either
1694with adb or the emulator. </p>
1695
1696<p>The emulator supports emulated SDHC cards, so you can create an SD card image
1697of any size up to 128 gigabytes.</p>
1698
1699<h3 id="creatinga">Creating an SD card image using the android tool</h3>
1700
1701<p>The easiest way to create a new SD card is to use the android tool. When
1702creating an AVD, you simply specify the <code>-c</code> option, like this: </p>
1703
1704<pre>android create avd -n &lt;avd_name&gt; -t &lt;targetID&gt; -c &lt;size&gt;[K|M]</pre>
1705
1706<p>You can also use the <code>-c</code> option to specify a path to an SD card
1707image to use in the new AVD. For more information, see <a
1708href="{@docRoot}guide/developing/tools/avd.html">Android Virtual Devices</a>.
1709</p>
1710
1711<h3 id="creatingm">Creating an SD card image using mksdcard</h3>
1712
1713<p>You can use the mksdcard tool, included in the SDK, to create a FAT32 disk
1714image that you can load in the emulator at startup. You can access mksdcard in
1715the tools/ directory of the SDK and create a disk image like this: </p>
1716
1717<pre>mksdcard &lt;size&gt; &lt;file&gt;</pre>
1718
1719<p>For example:</p>
1720
1721<pre>mksdcard 1024M sdcard1.iso</pre>
1722
1723<p>For more information, see <a href="{@docRoot}guide/developing/tools/othertools.html">Other Tools</a>. </p>
1724
1725<a name="copying"></a>
1726<h3>Copying Files to a Disk Image</h3>
1727
1728<p>Once you have created the disk image, you can copy files to it prior to
1729loading it in the emulator. To copy files, you can mount the image as a loop
1730device and then copy the files to it, or you can use a utility such as mtools to
1731copy the files directly to the image. The mtools package is available for Linux,
1732Mac, and Windows.</p>
1733
1734<a name="loading"></a>
1735<a name="step3" id="step3"></a>
1736
1737<h3>Loading the Disk Image at Emulator Startup</h3>
1738
1739<p>By default, the emulator loads the SD card image that is stored with the active
1740AVD (see the <code>-avd</code> startup option).</p>
1741
1742<p>Alternatively, you ca start the emulator with the
1743<code>-sdcard</code> flag and specify the name and path of your image (relative
1744to the current working directory): </p>
1745
1746<pre>emulator -sdcard &lt;filepath&gt;</pre>
1747
1748<a name="troubleshooting"></a>
1749
1750<h2>Troubleshooting Emulator Problems</h2>
1751
1752<p>The adb utility sees the emulator as an actual physical device. For this reason, you might have to use the -d flag with some common adb commands, such as <code>install</code>. The -d flag lets you specify which of several connected devices to use as the target of a command. If you don't specify -d, the emulator will target the first device in its list. For more information about adb, see <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a>.</p>
1753
1754<p>For emulators running on Mac OS X, if you see an error &quot;Warning: No DNS servers found&quot; when starting the emulator, check to see whether you have an <code>/etc/resolv.conf</code> file. If not, please run the following line in a command window:</p>
1755    <pre>ln -s /private/var/run/resolv.conf /etc/resolv.conf</pre>
1756
1757<p>See <a href="{@docRoot}resources/faq/index.html">Frequently Asked Questions</a> for more troubleshooting information. </p>
1758
1759<a name="limitations"></a>
1760    <h2>Emulator Limitations</h2>
1761    <p>In this release, the  limitations of the emulator include: </p>
1762    <ul>
1763      <li>No support for placing or receiving actual phone calls. You can simulate phone calls (placed and received) through the emulator console, however. </li>
1764      <li>No support for USB connections</li>
1765      <li>No support for camera/video capture (input).</li>
1766      <li>No support for device-attached headphones</li>
1767      <li>No support for determining connected state</li>
1768      <li>No support for determining battery charge level and AC charging state</li>
1769      <li>No support for determining SD card insert/eject</li>
1770      <li>No support for Bluetooth</li>
1771    </ul>
1772