1page.title=Android Emulator 2parent.title=Tools 3parent.link=index.html 4@jd:body 5 6<div id="qv-wrapper"> 7<div id="qv"> 8 9 <h2>In this document</h2> 10 <ol> 11 <li><a href="#KeyMapping">Keyboard Commands</a></li> 12 <li><a href="#startup-options">Command Line Parameters</a></li> 13 </ol> 14 15 <h2>See also</h2> 16 <ol> 17 <li><a href="{@docRoot}tools/devices/emulator.html">Using the Android Emulator</a></li> 18 <li><a href="{@docRoot}tools/devices/index.html">Managing Virtual Devices</a></li> 19 </ol> 20 21</div> 22</div> 23 24 25<p>The Android SDK includes a mobile device emulator — a virtual mobile device 26that runs on your computer. The emulator lets you develop and test 27Android applications without using a physical device.</p> 28 29<p>This document is a reference to the available command line options and the keyboard mapping to 30device keys. 31For a complete guide to using the Android Emulator, see 32<a href="{@docRoot}tools/devices/emulator.html">Using the Android Emulator</a>. 33 34 35<h2 id="KeyMapping">Keyboard Commands</h2> 36 37<p>Table 1 summarizes the mappings between the emulator keys and the keys of your keyboard.</p> 38 39<p class="table-caption"><strong>Table 1.</strong> Emulator keyboard mapping</p> 40<table border="0" style="clear:left;"> 41 <tr> 42 <th>Emulated Device Key </th> 43 <th>Keyboard Key </th> 44 </tr> 45 <tr> 46 <td>Home</td> 47 <td>HOME</td> 48 </tr> 49 <tr> 50 <td>Menu (left softkey)</td> 51 <td>F2 <em>or</em> Page-up button</td> 52 </tr> 53 <tr> 54 <td>Star (right softkey)</td> 55 <td>Shift-F2 <em>or </em>Page Down</td> 56 </tr> 57 <tr> 58 <td>Back</td> 59 <td>ESC</td> 60 </tr> 61 <tr> 62 <td>Call/dial button </td> 63 <td>F3</td> 64 </tr> 65 <tr> 66 <td>Hangup/end call button</td> 67 <td>F4</td> 68 </tr> 69 <tr> 70 <td>Search</td> 71 <td>F5 </td> 72 </tr> 73 <tr> 74 <td>Power button</td> 75 <td>F7 </td> 76 </tr> 77 <tr> 78 <td>Audio volume up button</td> 79 <td>KEYPAD_PLUS, Ctrl-F5</td> 80 </tr> 81 82 <tr> 83 <td>Audio volume down button</td> 84 <td>KEYPAD_MINUS, Ctrl-F6</td> 85 </tr> 86 <tr> 87 <td>Camera button</td> 88 <td>Ctrl-KEYPAD_5, Ctrl-F3</td> 89 </tr> 90 <tr> 91 <td>Switch to previous layout orientation (for example, portrait, landscape)</td> 92 <td>KEYPAD_7, Ctrl-F11</td> 93 </tr> 94 <tr> 95 <td>Switch to next layout orientation (for example, portrait, landscape)</td> 96 <td>KEYPAD_9, Ctrl-F12</td> 97 </tr> 98 <tr> 99 <td>Toggle cell networking on/off</td> 100 <td>F8</td> 101 </tr> 102 <tr> 103 <td>Toggle code profiling</td> 104 <td>F9 (only with <code>-trace</code> startup option)</td> 105 </tr> 106 <tr> 107 <td>Toggle fullscreen mode</td> 108 <td>Alt-Enter</td> 109 </tr> 110 <tr> 111 <td>Toggle trackball mode</td> 112 <td>F6</td> 113 </tr> 114 <tr> 115 <td>Enter trackball mode temporarily (while key is pressed)</td> 116 <td>Delete</td> 117 </tr> 118 <tr> 119 <td>DPad left/up/right/down</td> 120 <td>KEYPAD_4/8/6/2</td> 121 </tr> 122 <tr> 123 <td>DPad center click</td> 124 <td>KEYPAD_5</td> 125 </tr> 126 <tr> 127 <td>Onion alpha increase/decrease</td> 128 <td>KEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)</td> 129 </tr> 130</table> 131 132 133<h2 id="startup-options">Command Line Parameters</h2> 134 135<p>The emulator supports a variety of options that you can specify 136when launching the emulator, to control its appearance or behavior. 137Here's the command-line syntax of the options available to the {@code emulator} program:</p> 138 139<pre>emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]</pre> 140 141<p class="table-caption"><strong>Table 2.</strong> Emulator command line parameters</p> 142<table> 143<tr> 144 <th width="10%" >Category</th> 145 <th width="20%" >Option</th> 146 <th width="30%" >Description</th> 147 <th width="40%" >Comments</th> 148</tr> 149 150<tr> 151 <td>AVD</td> 152 <td><code>-avd <avd_name></code> or <br> 153 <code>@<avd_name></code></td> 154 <td><strong>Required</strong>. Specifies the AVD to load for this emulator 155 instance.</td> 156 <td>You must create an AVD configuration before launching the emulator. For 157 information, see <a href="{@docRoot}tools/devices/managing-avds.html">Managing 158 AVDs with AVD Manager</a>.</td> 159<tr> 160 <td rowspan="7">Disk Images</td> 161 <td><code>-cache <filepath></code></td> 162 <td>Use <filepath> as the working cache partition image. </td> 163 <td>An absolute or relative path to the current working directory. 164 If no cache file is specified, the emulator's default behavior is to use a temporary file instead. 165 <p>For more information on disk images, use <code>-help-disk-images</code>.</p> 166</td></tr> 167<tr> 168 <td><code>-data <filepath></code></td> 169 <td>Use {@code <filepath>} as the working user-data disk image. </td> 170 <td>Optionally, you can specify a path relative to the current working directory. 171 If <code>-data</code> is not used, the emulator looks for a file named {@code userdata-qemu.img} 172 in the storage area of the AVD being used (see <code>-avd</code>). 173</td></tr> 174<!-- 175<tr> 176 <td><code>-datadir <dir></code></td> 177 <td>Search for the user-data disk image specified in <code>-data</code> in <dir></td> 178 <td><code><dir></code> is a path relative to the current working directory. 179 180<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image 181in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information 182on disk images, use <code>-help-disk-images</code>.</p> 183</td></tr> 184--> 185<!-- 186<tr> 187 <td><code>-image <filepath></code></td> 188 <td>Use <filepath> as the system image.</td> 189 <td>Optionally, you can specify a path relative to the current working directory. 190 Default is <system>/system.img.</td> 191</tr> 192--> 193<tr> 194 <td><code>-initdata <filepath></code></td> 195 <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents 196 of this file to the new user-data disk image. By default, the emulator copies the <code><system>/userdata.img</code>.</td> 197 <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>. 198 <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td> 199</tr> 200<tr> 201 <td><code>-nocache</code></td> 202 <td>Start the emulator without a cache partition.</td> 203 <td>See also <code>-cache <file></code>.</td> 204</tr> 205<tr> 206 <td><code>-ramdisk <filepath></code></td> 207 <td>Use <filepath> as the ramdisk image.</td> 208 <td>Default value is <code><system>/ramdisk.img</code>. 209 <p>Optionally, you can specify a path relative to the current working directory. 210 For more information on disk images, use <code>-help-disk-images</code>.</p> 211</td> 212</tr> 213<tr> 214 <td><code>-sdcard <filepath></code></td> 215 <td>Use <file> as the SD card image.</td> 216 <td>Default value is <code><system>/sdcard.img</code>. 217 <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> 218</td> 219</tr> 220<!-- 221<tr> 222 <td><code>-system <dirpath></code></td> 223 <td>Search for system, ramdisk and user data images in <dir>.</td> 224 <td><code><dir></code> is a directory path relative to the current 225 working directory.</td> 226</tr> 227--> 228<tr> 229 <td><code>-wipe-data</code></td> 230 <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and 231 <code>-data</code>, or the default file). The emulator deletes all data from the user data image file, 232 then copies the contents of the file at <code>-inidata</code> data to the image file before starting. 233 </td> 234 <td>See also <code>-initdata</code>. 235 <p>For more information on disk images, use <code>-help-disk-images</code>.</p> 236</td> 237</tr> 238<tr> 239 <td rowspan="9">Debug</td> 240 <td><code>-debug <tags></code></td> 241 <td>Enable/disable debug messages for the specified debug tags.</td> 242 <td><code><tags></code> is a space/comma/column-separated list of debug component names. 243 Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td> 244</tr> 245<tr> 246 <td><code>-debug-<tag></code></td> 247 <td>Enable/disable debug messages for the specified debug tag.</td> 248 <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code><tag></code>. </td> 249</tr> 250<tr> 251 <td><code>-debug-no-<tag></code></td> 252 <td>Disable debug messages for the specified debug tag.</td> 253</tr> 254<tr> 255 <td><code>-logcat <logtags></code></td> 256 <td>Enable logcat output with given tags.</td> 257 <td>If the environment variable ANDROID_LOG_TAGS is defined and not 258 empty, its value will be used to enable logcat output by default.</td> 259</tr> 260<tr> 261 <td><code>-shell</code></td> 262 <td>Create a root shell console on the current terminal.</td> 263 <td>You can use this command even if the adb daemon in the emulated system is broken. 264 Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td> 265</tr> 266<tr> 267 <td><code>-shell-serial <device></code></td> 268 <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character 269 device to use for communication with the shell.</td> 270 <td><device> must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at 271 <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a> 272 for a list of device types. 273 274<p>Here are some examples: </p> 275<ul> 276 <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li> 277 <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li> 278 <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li> 279 <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> 280 </ul> 281</td> 282</tr> 283<tr> 284 <td><code>-show-kernel <name></code></td> 285 <td>Display kernel messages.</td> 286 <td> </td> 287</tr> 288<tr> 289 <td><code>-trace <name></code></td> 290 <td>Enable code profiling (press F9 to start), written to a specified file.</td> 291 <td> </td> 292</tr> 293<tr> 294 <td><code>-verbose</code></td> 295 <td>Enable verbose output.</td> 296 <td>Equivalent to <code>-debug-init</code>. 297<p>You can define the default verbose output options used by emulator instances in the Android environment variable 298ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option: 299<code>-debug-<tags>.</code> </p> 300<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options: 301<p><code>ANDROID_VERBOSE=init,modem</code></p> 302<p>For more information about debug tags, use <code><-help-debug-tags></code>.</p> 303</td> 304</tr> 305<tr> 306 <td rowspan="6">Media</td> 307 <td><code>-audio <backend></code></td> 308 <td>Use the specified audio backend.</td> 309 <td> </td> 310</tr> 311<tr> 312 <td><code>-audio-in <backend></code></td> 313 <td>Use the specified audio-input backend.</td> 314 <td> </td> 315</tr> 316<tr> 317 <td><code>-audio-out <backend></code></td> 318 <td>Use the specified audio-output backend.</td> 319 <td> </td> 320</tr> 321<!--<tr> 322 <td><code>-mic <device or file></code></td> 323 <td>Use device or WAV file for audio input.</td> 324 <td> </td> 325</tr> 326--> 327<tr> 328 <td><code>-noaudio</code></td> 329 <td>Disable audio support in the current emulator instance.</td> 330 <td> </td> 331</tr> 332<tr> 333 <td><code>-radio <device></code></td> 334 <td>Redirect radio modem interface to a host character device.</td> 335 <td> </td></tr> 336<tr> 337 <td><code>-useaudio</code></td> 338 <td>Enable audio support in the current emulator instance.</td> 339 <td>Enabled by default. </td> 340</tr> 341 342<tr> 343 <td rowspan="7">Network</td> 344 <td><code>-dns-server <servers></code></td> 345 <td>Use the specified DNS server(s). </td> 346 <td>The value of <code><servers></code> must be a comma-separated list of up to 4 DNS server names or 347 IP addresses.</td> 348</tr> 349<tr> 350 <td><code>-http-proxy <proxy></code></td> 351 <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td> 352 <td>The value of <code><proxy></code> can be one of the following:<br> 353 <code>http://<server>:<port></code><br> 354 <code>http://<username>:<password>@<server>:<port></code> 355 <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy <proxy></code> command is not supplied, 356 the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching 357 the <code><proxy></code> format described above.</p></td> 358</tr> 359<tr> 360 <td><code>-netdelay <delay></code></td> 361 <td>Set network latency emulation to <delay>.</td> 362 <td>Default value is <code>none</code>. See the table in 363 <a href="{@docRoot}tools/devices/emulator.html#netdelay">Network Delay Emulation</a> 364 for supported <code><delay></code> values. </td> 365</tr> 366<tr> 367 <td><code>-netfast</code></td> 368 <td>Shortcut for <code>-netspeed full -netdelay none</code></td> 369 <td> </td></tr> 370<tr> 371 <td><code>-netspeed <speed></code></td> 372 <td>Set network speed emulation to <speed>.</td> 373 <td>Default value is <code>full</code>. See the table in 374 <a href="{@docRoot}tools/devices/emulator.html#netspeed">Network Speed Emulation</a> for 375 supported <code><speed></code> values. </td> 376</tr> 377<tr> 378 <td><code>-port <port></code></td> 379 <td>Set the console port number for this emulator instance to <code><port></code>.</td> 380 <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code><port></code>+1 381 must also be free and will be reserved for ADB.</td> 382</tr> 383<tr> 384 <td><code>-report-console <socket></code></td> 385 <td>Report the assigned console port for this emulator instance to a remote third party 386 before starting the emulation. </td> 387 <td><code><socket></code> must use one of these formats: 388 389<p><code>tcp:<port>[,server][,max=<seconds>]</code></br> 390<code>unix:<port>[,server][,max=<seconds>]</code></p> 391 392<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td> 393</tr> 394<tr> 395 <td rowspan="10">System</td> 396 <td><code>-cpu-delay <delay></code></td> 397 <td>Slow down emulated CPU speed by <delay> </td> 398 <td>Supported values for <delay> are integers between 0 and 1000. 399 400<p>Note that the <delay> does not correlate to clock speed or other absolute metrics 401— it simply represents an abstract, relative delay factor applied non-deterministically 402in the emulator. Effective performance does not always 403scale in direct relationship with <delay> values.</p> 404</td> 405</tr> 406<tr> 407 <td><code>-gps <device></code></td> 408 <td>Redirect NMEA GPS to character device.</td> 409 <td>Use this command to emulate an NMEA-compatible GPS unit connected to 410 an external character device or socket. The format of <code><device></code> must be QEMU-specific 411 serial device specification. See the documentation for 'serial -dev' at 412 <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>. 413</td> 414</tr> 415<tr> 416 <td><code>-nojni</code></td> 417 <td>Disable JNI checks in the Dalvik runtime.</td><td> </td></tr> 418<tr> 419 <td><code>-qemu</code></td> 420 <td>Pass arguments to the qemu emulator software.</td> 421 <td><p class="caution"><strong>Important:</strong> When using this option, make sure it is the 422 <em>last option</em> specified, since all options after it are interpretted as qemu-specific 423 options.</p></td></tr> 424<tr> 425 <td><code>-qemu -enable-kvm</code></td> 426 <td>Enable KVM acceleration of the emulator virtual machine.</td> 427 <td>This option is only effective when your system is set up to use 428 <a href="{@docRoot}tools/devices/emulator.html#vm-linux">KVM-based VM acceleration</a>. 429 You can optionally specify a memory size ({@code -m <size>}) for the VM, which should match 430 your emulator's memory size:</p> 431 {@code -qemu -m 512 -enable-kvm}<br> 432 {@code -qemu -m 1024 -enable-kvm} 433 </td></tr> 434<tr> 435 <td><code>-qemu -h</code></td> 436 <td>Display qemu help.</td> 437 <td></td></tr> 438<tr> 439 <td><code>-gpu on</code></td> 440 <td>Turn on graphics acceleration for the emulator.</td> 441 <td>This option is only available for emulators using a system image with API Level 15, revision 3 442 and higher. For more information, see 443 <a href="{@docRoot}tools/devices/emulator.html#accel-graphics">Using the Android 444 Emulator</a>.</td></tr> 445<tr> 446 <td><code>-radio <device></code></td> 447 <td>Redirect radio mode to the specified character device.</td> 448 <td>The format of <code><device></code> must be QEMU-specific 449 serial device specification. See the documentation for 'serial -dev' at 450<a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>. 451</td> 452</tr> 453<tr> 454 <td><code>-timezone <timezone></code></td> 455 <td>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.</td> 456 <td><code><timezone></code> must be specified in zoneinfo format. For example: 457<p>"America/Los_Angeles"<br> 458"Europe/Paris"</p> 459</td> 460</tr> 461<tr> 462 <td><code>-version</code></td> 463 <td>Display the emulator's version number.</td> 464 <td> </td> 465</tr> 466<tr> 467 <td rowspan="12">UI</td> 468 <td><code>-dpi-device <dpi></code></td> 469 <td>Scale the resolution of the emulator to match the screen size 470 of a physical device.</td> 471 <td>The default value is 165. See also <code>-scale</code>.</td> 472</tr> 473<tr> 474 <td><code>-no-boot-anim</code></td> 475 <td>Disable the boot animation during emulator startup.</td> 476 <td>Disabling the boot animation can speed the startup time for the emulator.</td> 477</tr> 478<tr> 479 <td><code>-no-window</code></td> 480 <td>Disable the emulator's graphical window display.</td> 481 <td> </td> 482</tr> 483<tr> 484 <td><code>-scale <scale></code></td> 485 <td>Scale the emulator window. </td> 486 <td><code><scale></code> is a number between 0.1 and 3 that represents the desired scaling factor. You can 487 also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto" 488 tells the emulator to select the best window size.</td> 489</tr> 490<tr> 491 <td><code>-raw-keys</code></td> 492 <td>Disable Unicode keyboard reverse-mapping.</td> 493 <td> </td></tr> 494<tr> 495 <td><code>-noskin</code></td> 496 <td>Don't use any emulator skin.</td> 497 <td> </td></tr> 498<tr> 499 <td><code>-keyset <file></code></td> 500 <td>Use the specified keyset file instead of the default.</td> 501 <td>The keyset file defines the list of key bindings between the emulator and the host keyboard. 502 For more information, use <code>-help-keyset</code> to print information about this topic. 503</td> 504</tr> 505<tr> 506 <td><code>-onion <image></code></td> 507 <td>Use overlay image over screen.</td> 508 <td>No support for JPEG. Only PNG is supported.</td></tr> 509<tr> 510 <td><code>-onion-alpha <percent></code></td> 511 <td>Specify onion skin translucency value (as percent). 512 <td>Default is 50.</td> 513</tr> 514<tr> 515 <td><code>-onion-rotation <position></code></td> 516 <td>Specify onion skin rotation. 517 <td><code><position></code> must be one of the values 0, 1, 2, 3.</td> 518</tr> 519<tr> 520 <td><code>-skin <skinID></code></td> 521 <td>This emulator option is deprecated. </td> 522 <td>Please set skin options using AVDs, rather than by using this emulator 523option. Using this option may yield unexpected and in some cases misleading 524results, since the density with which to render the skin may not be defined. 525AVDs let you associate each skin with a default density and override the default 526as needed. For more information, see <a 527href="{@docRoot}tools/devices/managing-avds.html">Managing Virtual Devices 528with AVD Manager</a>. 529</td> 530</tr> 531<tr> 532 <td><code>-skindir <dir></code></td> 533 <td>This emulator option is deprecated. </td> 534 <td>See comments for <code>-skin</code>, above.</td> 535</tr> 536<tr> 537 <td rowspan="9">Help</td> 538 <td><code>-help</code></td> 539 <td>Print a list of all emulator options.</td> 540 <td> </td> 541</tr> 542<tr> 543 <td><code>-help-all</code></td> 544 <td>Print help for all startup options.</td> 545 <td> </td> 546</tr> 547<tr> 548 <td><code>-help-<option></code></td> 549 <td>Print help for a specific startup option.</td> 550 <td> </td> 551</tr> 552<tr> 553 <td><code>-help-debug-tags</code></td> 554 <td>Print a list of all tags for <code>-debug <tags></code>.</td> 555 <td> </td> 556</tr> 557<tr> 558 <td><code>-help-disk-images</code></td> 559 <td>Print help for using emulator disk images.</td> 560 <td> </td> 561 </tr> 562<tr> 563 <td><code>-help-environment</code></td> 564 <td>Print help for emulator environment variables.</td> 565 <td> </td>s 566</tr><tr> 567 <td><code>-help-keys</code></td> 568 <td>Print the current mapping of keys.</td> 569 <td> </td> 570</tr> 571<tr> 572 <td><code>-help-keyset-file</code></td> 573 <td>Print help for defining a custom key mappings file.</td> 574 <td> </td> 575</tr> 576<tr> 577 <td><code>-help-virtual-device</code></td> 578 <td>Print help for Android Virtual Device usage.</td> 579 <td> </td> 580</tr> 581</table> 582