1page.title=Managing AVDs with AVD Manager 2parent.title=Managing Virtual Devices 3parent.link=index.html 4@jd:body 5 6 <div id="qv-wrapper"> 7 <div id="qv"> 8 <h2>In this document</h2> 9 10 <ol> 11 <li><a href="#createavd">Creating an AVD</a> 12 <ol> 13 <li><a href="#CreateDefinition">Creating a device definition</a></li> 14 <li><a href="#hardwareopts">Hardware options</a></li> 15 </ol> 16 </li> 17 <li><a href="#skins">Creating Emulator Skins</a></li> 18 </ol> 19 </div> 20 </div> 21 22 <p>The AVD Manager is a tool you can use 23 to create and manage Android virtual devices (AVDs), which define device configurations 24 for the <a href="{@docRoot}tools/devices/emulator.html" 25 >Android Emulator</a>.</p> 26 27<p>To launch the AVD Manager:</p> 28<ul> 29 <li>In Android Studio, select <strong>Tools > Android > AVD Manager</strong>, or click 30 the AVD Manager icon <img src="{@docRoot}images/tools/avd-manager-studio.png" 31 style="vertical-align:bottom;margin:0;height:19px"> in the toolbar.</li> 32 33 <li>Or, use the command line to navigate to your SDK's <code>tools/</code> directory and execute: 34 <pre class="no-prettyprint classic">$ android avd</pre> 35 </li> 36</ul> 37 38 <p>The AVD Manager main screen shows your current virtual devices, as shown in figure 1.</p> 39 40 41 <img src="{@docRoot}images/studio-avdmgr-firstscreen.png" alt=""> 42 <p class="img-caption"><strong>Figure 1.</strong> The AVD Manager main screen shows your current 43 virtual devices.</p> 44 45 46<p class="note"><strong>Note:</strong> If you launch the AVD Manager from the command line, the UI 47is different than how it appears in Android Studio, as documented here. Most of the same 48functionality is available, but the command-line version of the AVD Manager 49is currently not documented.</p> 50 51 52 <h2 id="createavd">Creating an AVD</h2> 53 54 <p>You can create as many AVDs as you would like to use with the Android Emulator. 55 To effectively test your app, you should create an AVD that models each device type for which 56 you have designed your app to support. For instance, you should create an AVD for each 57 API level equal to and higher than the minimum version you've specified in your manifest 58 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html" style="white-space: nowrap;" 59 >{@code <uses-sdk>}</a> tag.</p> 60 61 <p>To create an AVD based on an existing device definition:</p> 62 63 <ol> 64 <li>From the main screen (figure 1), click <strong>Create Virtual Device</strong>.</li> 65 66 <li><p>In the Select Hardware window, select a device configuration, such as Nexus 6, 67 then click <strong>Next</strong>.</p> 68 69 <img src="{@docRoot}images/studio-avdmgr-selecthdwr.png" alt=""> 70 <p class="img-caption"><strong>Figure 2.</strong> The Select Hardware window.</p> 71 </li> 72 <li>Select the desired system version for the AVD and click <strong>Next</strong>. 73 </li> 74 <li>Verify the configuration settings, then click <strong>Finish</strong>. 75 <p>If necessary, click <strong>Show Advanced Settings</strong> to select a custom skin 76 for the hardware profile and adjust other hardware settings.</p> 77 </li> 78 </ol> 79 80 <p>To launch the AVD in the Android Emulator, click the launch button 81 <img src="{@docRoot}images/tools/as-avd-start.png" 82 style="vertical-align:bottom;margin:0;height:19px"> 83 in the list of AVDs.</p> 84 85 86<h3 id="CreateDefinition">Creating a device definition</h3> 87 88<p>In case the available device definitions do not match the device type you'd like to emulate, 89you can create a custom device definition for your AVD:</p> 90<ol> 91 <li>From the main screen (figure 1), click <strong>Create Virtual Device</strong>.</li> 92 <li>To begin you custom device by using an existing device profile as a template, select 93 a device profile then click <strong>Clone Device</strong>. 94 <p>Or, to start from scratch, click <strong>New Hardware Profile</strong>.</p> 95 </li> 96 <li> 97<p>The following Configure Hardware Profile window (figure 3) allows you to specify various 98configurations such as the screen size, memory options, input type, and sensors.</p> 99 100 <p>When you're done configuring the device, click <strong>Finish</strong>.</p> 101 102 <img src="{@docRoot}images/studio-avdmgr-confighardwareprof.png" alt=""> 103 <p class="img-caption"><strong>Figure 3.</strong> The Configure Hardware window when 104 creating a custom device configuration.</p> 105 </li> 106 <li>Your custom device configuration is now available in the list of device definitions 107 (shown after you click <strong>Create Virtual Device</strong>). To continue preparing an AVD 108 with your custom device configuration, select the new configuration and follow the instructions 109 above to create an AVD with an existing device definition (and select your new definition).</li> 110 111 </ol> 112 113 114 115<h3 id="hardwareopts">Hardware options</h3> 116 117<p>If you are creating a new AVD, you can specify the following hardware options for the AVD 118to emulate:</p> 119 120 <table> 121 <tr> 122 <th>Characteristic</th> 123 124 <th>Description</th> 125 126 <th>Property</th> 127 </tr> 128 129 <tr> 130 <td>Device ram size</td> 131 132 <td>The amount of physical RAM on the device, in megabytes. Default value is "96".</td> 133 134 <td>hw.ramSize</td> 135 </tr> 136 137 <tr> 138 <td>Touch-screen support</td> 139 140 <td>Whether there is a touch screen or not on the device. Default value is "yes".</td> 141 142 <td>hw.touchScreen</td> 143 </tr> 144 145 <tr> 146 <td>Trackball support</td> 147 148 <td>Whether there is a trackball on the device. Default value is "yes".</td> 149 150 <td>hw.trackBall</td> 151 </tr> 152 153 <tr> 154 <td>Keyboard support</td> 155 156 <td>Whether the device has a QWERTY keyboard. Default value is "yes".</td> 157 158 <td>hw.keyboard</td> 159 </tr> 160 161 <tr> 162 <td>DPad support</td> 163 164 <td>Whether the device has DPad keys. Default value is "yes".</td> 165 166 <td>hw.dPad</td> 167 </tr> 168 169 <tr> 170 <td>GSM modem support</td> 171 172 <td>Whether there is a GSM modem in the device. Default value is "yes".</td> 173 174 <td>hw.gsmModem</td> 175 </tr> 176 177 <tr> 178 <td>Camera support</td> 179 180 <td>Whether the device has a camera. Default value is "no".</td> 181 182 <td>hw.camera</td> 183 </tr> 184 185 <tr> 186 <td>Maximum horizontal camera pixels</td> 187 188 <td>Default value is "640".</td> 189 190 <td>hw.camera.maxHorizontalPixels</td> 191 </tr> 192 193 <tr> 194 <td>Maximum vertical camera pixels</td> 195 196 <td>Default value is "480".</td> 197 198 <td>hw.camera.maxVerticalPixels</td> 199 </tr> 200 201 <tr> 202 <td>GPS support</td> 203 204 <td>Whether there is a GPS in the device. Default value is "yes".</td> 205 206 <td>hw.gps</td> 207 </tr> 208 209 <tr> 210 <td>Battery support</td> 211 212 <td>Whether the device can run on a battery. Default value is "yes".</td> 213 214 <td>hw.battery</td> 215 </tr> 216 217 <tr> 218 <td>Accelerometer</td> 219 220 <td>Whether there is an accelerometer in the device. Default value is "yes".</td> 221 222 <td>hw.accelerometer</td> 223 </tr> 224 225 <tr> 226 <td>Audio recording support</td> 227 228 <td>Whether the device can record audio. Default value is "yes".</td> 229 230 <td>hw.audioInput</td> 231 </tr> 232 233 <tr> 234 <td>Audio playback support</td> 235 236 <td>Whether the device can play audio. Default value is "yes".</td> 237 238 <td>hw.audioOutput</td> 239 </tr> 240 241 <tr> 242 <td>SD Card support</td> 243 244 <td>Whether the device supports insertion/removal of virtual SD Cards. Default value is 245 "yes".</td> 246 247 <td>hw.sdCard</td> 248 </tr> 249 250 <tr> 251 <td>Cache partition support</td> 252 253 <td>Whether we use a /cache partition on the device. Default value is "yes".</td> 254 255 <td>disk.cachePartition</td> 256 </tr> 257 258 <tr> 259 <td>Cache partition size</td> 260 261 <td>Default value is "66MB".</td> 262 263 <td>disk.cachePartition.size</td> 264 </tr> 265 266 <tr> 267 <td>Abstracted LCD density</td> 268 269 <td>Sets the generalized density characteristic used by the AVD's screen. Default value is 270 "160".</td> 271 272 <td>hw.lcd.density</td> 273 </tr> 274 </table> 275 276 277<h2 id="skins">Creating Emulator Skins</h2> 278 279<p>An Android emulator skin is a collection of files that define the visual and control elements of 280an emulator display. If the skin definitions available in the AVD settings don't meet your needs, 281you can create your own custom skin definition, then apply it to your AVD from the 282advanced settings on the Verify Configuration screen.</p> 283 284<p>Each emulator skin contains:</p> 285 <ul> 286 <li>A <code>hardware.ini</code> file</li> 287 <li>Layout files for supported orientations (landscape, portrait) and physical configuration</li> 288 <li>Image files for display elements, such as background, keys and buttons</li> 289 </ul> 290<p>To create and use a custom skin:</p> 291 <ol> 292 <li>Create a new directory where you will save your skin configuration files. </li> 293 <li>Define the visual appearance of the skin in a text file named 294 <code>layout</code>. This file defines many characteristics of the skin, such as the 295 size and image assets for specific buttons. For example: 296<pre class="no-prettyprint"> 297parts { 298 device { 299 display { 300 width 320 301 height 480 302 x 0 303 y 0 304 } 305 } 306 307 portrait { 308 background { 309 image background_port.png 310 } 311 312 buttons { 313 power { 314 image button_vertical.png 315 x 1229 316 y 616 317 } 318 } 319 } 320 ... 321} 322</pre></li> 323 324 <li>Add the bitmap files of the device images in the same directory.</li> 325 <li>Specify additional hardware-specific device configurations an <code>hardware.ini</code> 326 file for the device settings, such as <code>hw.keyboard</code> and 327 <code>hw.lcd.density</code>.</li> 328 <li>Archive the files in the skin folder and select the archive file as a custom skin. </li> 329</ol> 330 331<p>For more detailed information about creating emulator skins, see the 332<a href="https://android.googlesource.com/platform/external/qemu.git/+/master/docs/ANDROID-SKIN-FILES.TXT" 333>Android Emulator Skin File Specification</a> in the tools source code.</p> 334 335 336 337