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