android:emulator-start

Full name:

com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0:emulator-start

Description:

EmulatorStartMojo can start the Android Emulator with a specified Android Virtual Device (avd).

Attributes:

Optional Parameters

Name Type Since Description
aaptExtraArgs String[] - A list of extra arguments that must be passed to aapt.
androidManifestFile File - The AndroidManifest.xml file.
Default value is: ${project.basedir}/AndroidManifest.xml.
assetsDirectory File - The android assets directory.
Default value is: ${project.basedir}/assets.
attachJar boolean -

Whether to attach the normal .jar file to the build, so it can be depended on by for example integration-tests which may then access R.java from this project.

Only disable it if you know you won't need it for any integration-tests. Otherwise, leave it enabled.


Default value is: true.
attachSources boolean -

Whether to attach sources to the build, which can be depended on by other apk projects, for including them in their builds.

Enabling this setting is only required if this project's source code and/or res(ources) will be included in other projects, using the Maven <dependency> tag.


Default value is: false.
configurations String - A selection of configurations to be included in the APK as a comma separated list. This will limit the configurations for a certain type. For example, specifying hdpi will exclude all resource folders with the mdpi or ldpi modifiers, but won't affect language or orientation modifiers. For more information about this option, look in the aapt command line help.
customPackage String - Generates R.java into a different package.
device String - Specifies which device to connect to, by serial number. Special values "usb" and "emulator" are also valid, for selecting the only USB connected device or the only running emulator, respectively.
emulator Emulator - Configuration for the emulator goals. Either use the plugin configuration like this
<emulator>
  <avd>Default</avd>
  <wait>20000</wait>
  <options>-no-skin</options>
</emulator>
or configure as properties on the command line as android.emulator.avd, android.emulator.wait and android.emulator.options or in pom or settings file as emulator.avd, emulator.wait and emulator.options.
emulatorAvd String - Name of the Android Virtual Device (emulatorAvd) that will be started by the emulator. Default value is "Default"
emulatorOptions String - Additional command line options for the emulator start up. This option can be used to pass any additional options desired to the invocation of the emulator. Use emulator -help for more details. An example would be "-no-skin".
emulatorWait String - Wait time for the emulator start up.
generateApk boolean - Decides whether the Apk should be generated or not. If set to false, dx and apkBuilder will not run. This is probably most useful for a project used to generate apk sources to be inherited into another application project.
Default value is: true.
nativeLibrariesDirectory File -

Root folder containing native libraries to include in the application package.


Default value is: ${project.basedir}/libs.
resourceDirectory File - The android resources directory.
Default value is: ${project.basedir}/res.
resourceOverlayDirectories File[] - The android resources overlay directories. If this is specified, the resourceOverlayDirectory parameter will be ignored.
resourceOverlayDirectory File - The android resources overlay directory. This will be overriden by resourceOverlayDirectories if present.
Default value is: ${project.basedir}/res-overlay.
sdk Sdk -

The Android SDK to use.

Looks like this:

<sdk>
    <path>/opt/android-sdk-linux</path>
    <platform>2.1</platform>
</sdk>

The <platform> parameter is optional, and corresponds to the platforms/android-* directories in the Android SDK directory. Default is the latest available version, so you only need to set it if you for example want to use platform 1.5 but also have e.g. 2.2 installed. Has no effect when used on an Android SDK 1.1. The parameter can also be coded as the API level. Therefore valid values are 1.1, 1.5, 1.6, 2.0, 2.01, 2.1, 2,2 as well as 3, 4, 5, 6, 7, 8. If a platform/api level is not installed on the machine an error message will be produced.

The <path> parameter is optional. The default is the setting of the ANDROID_HOME environment variable. The parameter can be used to override this setting with a different environment variable like this:

<sdk>
    <path>${env.ANDROID_SDK}</path>
</sdk>

or just with a hardcoded absolute path. The parameters can also be configured from command-line with parameters -Dandroid.sdk.path and -Dandroid.sdk.platform.


undeployBeforeDeploy boolean -

Whether to undeploy an apk from the device before deploying it.

Only has effect when running mvn android:deploy in an Android application project manually, or when running mvn integration-test (or mvn install) in a project with instrumentation tests.

It is useful to keep this set to true at all times, because if an apk with the same package was previously signed with a different keystore, and deployed to the device, deployment will fail becuase your keystore is different.


Default value is: false.

Parameter Details

aaptExtraArgs:

A list of extra arguments that must be passed to aapt.
  • Type: java.lang.String[]
  • Required: No
  • Expression: ${android.aaptExtraArgs}

androidManifestFile:

The AndroidManifest.xml file.
  • Type: java.io.File
  • Required: No
  • Default: ${project.basedir}/AndroidManifest.xml

assetsDirectory:

The android assets directory.
  • Type: java.io.File
  • Required: No
  • Default: ${project.basedir}/assets

attachJar:

Whether to attach the normal .jar file to the build, so it can be depended on by for example integration-tests which may then access R.java from this project.

Only disable it if you know you won't need it for any integration-tests. Otherwise, leave it enabled.

  • Type: boolean
  • Required: No
  • Expression: ${android.attachJar}
  • Default: true

attachSources:

Whether to attach sources to the build, which can be depended on by other apk projects, for including them in their builds.

Enabling this setting is only required if this project's source code and/or res(ources) will be included in other projects, using the Maven <dependency> tag.

  • Type: boolean
  • Required: No
  • Expression: ${android.attachSources}
  • Default: false

configurations:

A selection of configurations to be included in the APK as a comma separated list. This will limit the configurations for a certain type. For example, specifying hdpi will exclude all resource folders with the mdpi or ldpi modifiers, but won't affect language or orientation modifiers. For more information about this option, look in the aapt command line help.
  • Type: java.lang.String
  • Required: No
  • Expression: ${android.configurations}

customPackage:

Generates R.java into a different package.
  • Type: java.lang.String
  • Required: No
  • Expression: ${android.customPackage}

device:

Specifies which device to connect to, by serial number. Special values "usb" and "emulator" are also valid, for selecting the only USB connected device or the only running emulator, respectively.
  • Type: java.lang.String
  • Required: No
  • Expression: ${android.device}

emulator:

Configuration for the emulator goals. Either use the plugin configuration like this
<emulator>
  <avd>Default</avd>
  <wait>20000</wait>
  <options>-no-skin</options>
</emulator>
or configure as properties on the command line as android.emulator.avd, android.emulator.wait and android.emulator.options or in pom or settings file as emulator.avd, emulator.wait and emulator.options.
  • Type: com.jayway.maven.plugins.android.configuration.Emulator
  • Required: No

emulatorAvd:

Name of the Android Virtual Device (emulatorAvd) that will be started by the emulator. Default value is "Default"
  • Type: java.lang.String
  • Required: No
  • Expression: ${android.emulator.avd}

emulatorOptions:

Additional command line options for the emulator start up. This option can be used to pass any additional options desired to the invocation of the emulator. Use emulator -help for more details. An example would be "-no-skin".
  • Type: java.lang.String
  • Required: No
  • Expression: ${android.emulator.options}

emulatorWait:

Wait time for the emulator start up.
  • Type: java.lang.String
  • Required: No
  • Expression: ${android.emulator.wait}

generateApk:

Decides whether the Apk should be generated or not. If set to false, dx and apkBuilder will not run. This is probably most useful for a project used to generate apk sources to be inherited into another application project.
  • Type: boolean
  • Required: No
  • Expression: ${android.generateApk}
  • Default: true

nativeLibrariesDirectory:

Root folder containing native libraries to include in the application package.

  • Type: java.io.File
  • Required: No
  • Expression: ${android.nativeLibrariesDirectory}
  • Default: ${project.basedir}/libs

resourceDirectory:

The android resources directory.
  • Type: java.io.File
  • Required: No
  • Default: ${project.basedir}/res

resourceOverlayDirectories:

The android resources overlay directories. If this is specified, the resourceOverlayDirectory parameter will be ignored.
  • Type: java.io.File[]
  • Required: No

resourceOverlayDirectory:

The android resources overlay directory. This will be overriden by resourceOverlayDirectories if present.
  • Type: java.io.File
  • Required: No
  • Default: ${project.basedir}/res-overlay

sdk:

The Android SDK to use.

Looks like this:

<sdk>
    <path>/opt/android-sdk-linux</path>
    <platform>2.1</platform>
</sdk>

The <platform> parameter is optional, and corresponds to the platforms/android-* directories in the Android SDK directory. Default is the latest available version, so you only need to set it if you for example want to use platform 1.5 but also have e.g. 2.2 installed. Has no effect when used on an Android SDK 1.1. The parameter can also be coded as the API level. Therefore valid values are 1.1, 1.5, 1.6, 2.0, 2.01, 2.1, 2,2 as well as 3, 4, 5, 6, 7, 8. If a platform/api level is not installed on the machine an error message will be produced.

The <path> parameter is optional. The default is the setting of the ANDROID_HOME environment variable. The parameter can be used to override this setting with a different environment variable like this:

<sdk>
    <path>${env.ANDROID_SDK}</path>
</sdk>

or just with a hardcoded absolute path. The parameters can also be configured from command-line with parameters -Dandroid.sdk.path and -Dandroid.sdk.platform.

  • Type: com.jayway.maven.plugins.android.configuration.Sdk
  • Required: No

undeployBeforeDeploy:

Whether to undeploy an apk from the device before deploying it.

Only has effect when running mvn android:deploy in an Android application project manually, or when running mvn integration-test (or mvn install) in a project with instrumentation tests.

It is useful to keep this set to true at all times, because if an apk with the same package was previously signed with a different keystore, and deployed to the device, deployment will fail becuase your keystore is different.

  • Type: boolean
  • Required: No
  • Expression: ${android.undeployBeforeDeploy}
  • Default: false