Skip to content

rbm avd config

inazaruk edited this page Jan 19, 2012 · 41 revisions

rbm-avd-config

Go to home | documentation | ant tasks

AVD is represented with a number of files on disk. It can be considered as emulator image that has specific configuration and can be used to start an emulator.

This task does not create an actual AVD, it only creates AVD configuration that is held in memory and can be used later to create the AVD. In other words, it defines AVD prototype that can be used to create an AVD. Note that user can create AVDs using rbm-create-avd task, which takes reference to AVD configuration that is defined using this task.

Everything that can be configured using Android SDK UI or command line tools, can also be configured using this task. This includes abi type, sdcard size, screen resolution & density, and any other hardware options that are available out there.

Note that many different configurations might be defined without creating actual AVDs. One could even create an xml "library" with AVD configurations and use it in different places, or even share it with others.


Prototype

<rbm-avd-config id="${avd.name}" target="${avd.target}">
    <abi type="${avd.abi}" />
    <snapshot enable="${use.snapshots}" />
    <sdcard size="${sdcard.size}" location="${sdcard.file}" />
    <screen resolution="${resolution}" density="${density}" />
    <hardware>
        <ram size="${ram.size}" />
        <heap size="${heap.size}" />
        <arg key="${custom.hardware.arg}" value="${custom.hardware.arg.value}" />
    </hardware>
</rbm-avd-config>

Attributes

  • id - required, name of configuration. If another configuration with such name already existed, it will be discarded.
  • target - required, target name.

Elements

The abi element

<abi type="${avd.abi}" />

If element is not specified, default abi will be selected. If element is specified then attribute type is required. This should be a valid abi type, otherwise task will fail.

The snapshot element

<snapshot enable="${use.snapshots}" />`

If this element not specified, snapshots will be disabled. If element is specified then enable attribute is required.

The sdcard element

<sdcard size="${sdcard.size}" location="${sdcard.file}" />

If element is not specified, no sdcard will be created. If element is specified, either size or location attributes must be specified. If both are specified then location takes precedence and size is ignored.

  • size - size of sdcard. Available modifiers: k, kb for kilobytes, m, mb for megabytes and g, gb for gigabytes. Note that there is a minimum valid size (around 8Mb at the time of writing) and maximum (something around 10+GB). If no specifier is used then m is assumed (i.e. value is treated in megabytes).

  • location - location of already existing sdcard.

The screen element

<screen resolution="${resolution}" density="${density}" />

If not specified, default values are used. Defaults are target specific (i.e. android-8 might have different defaults then android-13).

  • density - optional, defaults to target specific value. If screen element is used, its better to explicitly specify this value. This can be either a number (like 120, 160, 240, etc.), or one of supported aliases: ldpi for 120, mdpi for 160, hdpi for 240, xhdpi for 320.

  • resolution - optional, defaults to target specific value. This can be either resolution like 1024x240, or a skin name like WVGA800.

Supported resolution formats:

  1. dividers: x,/,\,*. Examples: 100x100, 100/100, 100\100, 100*100,
  2. specifiers: px and dp. Examples: 100px200dp, 300dp100dp, 100200dp. Note that if specifier is omitted, px is used (i.e. 100200 => 100px*200px). Also note that if dp specifier is used then density attribute is required (there is no way to know what is default density before creating an AVD).

Supported skin names:

Each android target has list of pre-defined skins for it. For example, android-8(Froyo) has next skins available: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800, WVGA854. While android-13 (Honeycomb) has only one supported skin: WXGA.

If invalid skin is used, task will fail.

The hardware element

You can supply custom hardware arguments. Usually this takes a form of:

<arg name="${arg.name}" value="${arg.value}" />

But there are number of predefined helpers. They are:

<ram size="${ram.size}" />
<heap size="${heap.size}" />

All other arguments should be used via:

<arg name="hw.arg.name" value="hw.arg.value" />

Examples

Simplest configuration:

<rbm-avd-config id="avd.name" target="android-15" />

Enabling snapshot:

<rbm-avd-config id="avd.name" target="android-15" >
    <snapshot enable="true" />
</rbm-avd-config>

Using sdcard:

<rbm-avd-config id="avd.name" target="android-13" >
    <sdcard size="100kb" /> 
</rbm-avd-config>

Using custom screen:

<rbm-avd-config id="avd.name" target="android-8" >
    <screen resolution="100dp*100dp" density="mdpi" /> 
</rbm-avd-config>

Puting it all together:

<rbm-avd-config id="avd.name" target="android-8" >
    <abi type="armeabi" />
    <snapshot enable="true" />
    <sdcard size="100m" />
    <screen resolution="100*100dp" density="mdpi" />
    <hardware>
        <ram size="1024" />
        <heap size="32" />
        <arg key="name1" value="value" />
        <arg key="name2" value="value" />
    </hardware>
</rbm-avd-config>

Go to home | documentation | ant tasks

Clone this wiki locally