Skip to content

rbm start emulator

inazaruk edited this page Jan 19, 2012 · 19 revisions

rbm-start-emulator

Go to home | documentation | ant tasks

This task starts emulators and tries to do this in a reliable and stable way. It handles different known bugs and issues with different emulator target levels.

There are three timeout timers that can be specified: adb connect timeout, boot timeout, and low cpu timeout.


Prototype

<rbm-start-emulator avd="${avd.name}" 
                    serialProperty="{out.emulator.serial}" 
                    connectTimeout="${connect.timeout}" 
                    bootTimeout="${boot.timeout}"
                    lowCpuTimeout="${low.cpu.timeout}" 
                    lowCpuThreshold="${low.cpu.threshold}" 
                    attempts="${attempts}" >
    <arg value="${value1}" />
    <arg value="${value2}" />
</rbm-start-emulator>

Attrbibutes

  • avd - required, name of avd to use for starting emulator. Be careful when starting several emulators from same AVD. This usually results in a less stable exprience, apart from the fact that sdcard becomes read-only for non-first started emulators.

  • serialProperty - required, name of property that will hold serial number of just started emulator (if start was successful).

  • connectTimeout - optional, default: 120000 (2 minutes), a value should be specified in milliseconds . How much time emulator has to connect to adb after it was started. In other words, when adb devices is run, emulator should be in device or online state. If device doesn't connect in time, attempt is counted as failed.

  • bootTimeout - optional, default: 300000 (5 minutes), a value should be specified in milliseconds. How much time emulator has to fully boot up. This starts to be counted only after emulator connects to adb. If emulator is not booted within the timeout, attempt is counted as failed.

  • lowCpuTimeout - optional, default: 6000 (1 minute), a value should be specified in milliseconds. How much time emulator has for CPU to be loaded less then specific threshold (like < 30%). This starts to be counted only after emulator fully boots. If emulator fails to reach CPU load that is lower than threashold within specified timeout an attempt still counts as successful. This is more of a helper timeout.

  • lowCpuThreshold - optional, default: 30 (30%). Specifies CPU load threshold in percents. If CPU load is lower then this threshold for around 15 seconds (not configurable) then threshold timer is stopped. Emulator is then considered to be ready for use.

  • attempts - optional, default: 3. How many attempts are made to start the emulator before task fails.


Elements

The arg element

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

This element can appear multiple times. All values are directly passed to emulator.


Examples

The simplest example:

<rbm-start-emulator avd="${avd.name}" serialProperty="emulator-serial" />
<rbm-stop-emulator serial="${emulator-serial}" />

Or you can go and fully customize all options:

<rbm-start-emulator avd="${avd.name}" 
                    serialProperty="emulator-serial" 
                    connectTimeout="180000" 
                    bootTimeout="600000"
                    lowCpuTimeout="3000" 
                    lowCpuThreshold="50" 
                    attempts="5" >

    <arg value="-no-audio" />
    <arg value="-no-window" />

</rbm-start-emulator>

Go to home | documentation | ant tasks

Clone this wiki locally