แก้ไข

แชร์ผ่าน


AndroidBuild@1 - Android Build v1 task

Use this task to build an Android app using Gradle and (optionally) start the emulator for unit tests.

The AndroidBuild@1 task is deprecated. Use the Gradle task instead.

Syntax

# Android Build v1
# AndroidBuild@1 is deprecated. Use Gradle.
- task: AndroidBuild@1
  inputs:
    #gradleWrapper: # string. Location of Gradle Wrapper. 
    #gradleProj: # string. Project Directory. 
    #gradleArguments: 'build' # string. Gradle Arguments. Default: build.
  # Android Virtual Device (AVD) Options
    avdName: 'AndroidBuildEmulator' # string. Required. Name. Default: AndroidBuildEmulator.
    #createAvd: AndroidBuildEmulator # boolean. Create AVD. Default: AndroidBuildEmulator.
    #emulatorTarget: 'android-19' # string. Required when createAvd = true. AVD Target SDK. Default: android-19.
    #emulatorDevice: 'Nexus 5' # string. Optional. Use when createAvd = true. AVD Device. Default: Nexus 5.
    #avdAbi: 'default/armeabi-v7a' # string. Required when createAvd = true. AVD ABI. Default: default/armeabi-v7a.
    #avdForce: false # boolean. Optional. Use when createAvd = true. Overwrite Existing AVD. Default: false.
    #avdOptionalArgs: # string. Optional. Use when createAvd = true. Create AVD Optional Arguments. 
  # Emulator Options
    #startEmulator: false # boolean. Start and Stop Android Emulator. Default: false.
    #emulatorTimeout: '300' # string. Required when startEmulator = true. Timeout in Seconds. Default: 300.
    #emulatorHeadless: false # boolean. Optional. Use when startEmulator = true. Headless Display. Default: false.
    #emulatorOptionalArgs: '-no-snapshot-load -no-snapshot-save' # string. Optional. Use when startEmulator = true. Emulator Optional Arguments. Default: -no-snapshot-load -no-snapshot-save.
    #deleteAvd: false # boolean. Optional. Use when startEmulator = true. Delete AVD. Default: false.

Inputs

gradleWrapper - Location of Gradle Wrapper
string.

The location of the gradlew wrapper that is used for the build. Agents on Windows (including Microsoft-hosted agents) must use the gradlew.bat wrapper. Agents on Linux or macOS can use the gradlew shell script. Learn more about the Gradle Wrapper.


gradleProj - Project Directory
string.

The relative path from the repo root to the root directory of the application. This is most likely to be where the build.gradle file is located.


gradleArguments - Gradle Arguments
string. Default value: build.

Provides any options to pass to the Gradle command line. Learn more about the Gradle command line.


avdName - Name
string. Required. Default value: AndroidBuildEmulator.

The name of the Android Virtual Device (AVD) to be started or created.

You must deploy your own agent to use this string. You cannot use a Microsoft-hosted pool if you want to create an AVD.


createAvd - Create AVD
boolean. Default value: AndroidBuildEmulator.

Creates the named Android Virtual Device (AVD).


emulatorTarget - AVD Target SDK
string. Required when createAvd = true. Default value: android-19.

The Android SDK version that the Android Virtual Device (AVD) targets.


emulatorDevice - AVD Device
string. Optional. Use when createAvd = true. Default value: Nexus 5.

The device pipeline that may be used. This can be a device index or an Id.


avdAbi - AVD ABI
string. Required when createAvd = true. Default value: default/armeabi-v7a.

The Application Binary Interface (ABI) to use for the Android Virtual Device (AVD). Learn more about ABI Management.


avdForce - Overwrite Existing AVD
boolean. Optional. Use when createAvd = true. Default value: false.

Overwrites an existing AVD by passing --force to the android create avd command.


avdOptionalArgs - Create AVD Optional Arguments
string. Optional. Use when createAvd = true.

Creates additional arguments to pass to android create avd.


startEmulator - Start and Stop Android Emulator
boolean. Default value: false.

Starts and stops the Android emulator after the Android Build task finishes.

You must deploy your own agent to use this boolean. You cannot use a Microsoft-hosted pool if you want to use an emulator. Learn more about Azure Pipeline agents.


emulatorTimeout - Timeout in Seconds
string. Required when startEmulator = true. Default value: 300.

Defines how long (in seconds) the build will wait for the emulator to start.


emulatorHeadless - Headless Display
boolean. Optional. Use when startEmulator = true. Default value: false.

Starts the emulator with no GUI (headless mode) by using the -no-skin -no-audio -no-window value.


emulatorOptionalArgs - Emulator Optional Arguments
string. Optional. Use when startEmulator = true. Default value: -no-snapshot-load -no-snapshot-save.

Provides additional arguments to pass to the emulator command.


deleteAvd - Delete AVD
boolean. Optional. Use when startEmulator = true. Default value: false.

Deletes the AVD upon task completion.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: AndroidSDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.83.0 or greater
Task category Build