Редактиране

Споделяне чрез


AndroidSigning@3 - Android Signing v3 task

Use this task in a pipeline to sign and align Android APK files.

Syntax

# Android Signing v3
# Sign and align Android APK files.
- task: AndroidSigning@3
  inputs:
    apkFiles: '**/*.apk' # string. Alias: files. Required. APK files. Default: **/*.apk.
  # Signing Options
    #apksign: true # boolean. Sign the APK. Default: true.
    apksignerKeystoreFile: # string. Alias: keystoreFile. Required when apksign = true. Keystore file. 
    #apksignerKeystorePassword: # string. Alias: keystorePass. Optional. Use when apksign = true. Keystore password. 
    #apksignerKeystoreAlias: # string. Alias: keystoreAlias. Optional. Use when apksign = true. Alias. 
    #apksignerKeyPassword: # string. Alias: keyPass. Optional. Use when apksign = true. Key password. 
    #apksignerVersion: 'latest' # string. Optional. Use when apksign = true. apksigner version. Default: latest.
    #apksignerArguments: '--verbose' # string. Optional. Use when apksign = true. apksigner arguments. Default: --verbose.
    #apksignerFile: # string. Alias: apksignerLocation. Optional. Use when apksign = true. apksigner location. 
  # Zipalign Options
    #zipalign: true # boolean. Zipalign. Default: true.
    #zipalignVersion: 'latest' # string. Optional. Use when zipalign = true. Zipalign version. Default: latest.
    #zipalignFile: # string. Alias: zipalignLocation. Optional. Use when zipalign = true. Zipalign location.
# Android Signing v3
# Sign and align Android APK files.
- task: AndroidSigning@3
  inputs:
    apkFiles: '**/*.apk' # string. Alias: files. Required. APK files. Default: **/*.apk.
  # Signing Options
    #apksign: true # boolean. Sign the APK. Default: true.
    apksignerKeystoreFile: # string. Alias: keystoreFile. Required when apksign = true. Keystore file. 
    #apksignerKeystorePassword: # string. Alias: keystorePass. Optional. Use when apksign = true. Keystore password. 
    #apksignerKeystoreAlias: # string. Alias: keystoreAlias. Optional. Use when apksign = true. Alias. 
    #apksignerKeyPassword: # string. Alias: keyPass. Optional. Use when apksign = true. Key password. 
    #apksignerArguments: '--verbose' # string. Optional. Use when apksign = true. apksigner arguments. Default: --verbose.
    #apksignerFile: # string. Alias: apksignerLocation. Optional. Use when apksign = true. apksigner location. 
  # Zipalign Options
    #zipalign: true # boolean. Zipalign. Default: true.
    #zipalignFile: # string. Alias: zipalignLocation. Optional. Use when zipalign = true. Zipalign location.

Inputs

apkFiles - APK files
Input alias: files. string. Required. Default value: **/*.apk.

The relative path from the repo root to the APK(s) you want to sign. You can use wildcards to specify multiple files. For example:

  • outputs\apk*.apk to sign all .APK files in the outputs\apk\ subfolder.
  • **/bin/*.apk to sign all .APK files in all bin subfolders.

apksign - Sign the APK
boolean. Default value: true.

Signs the APK with a provided Android Keystore file. Unsigned APKs can only run in an emulator. APKs must be signed to run on a device.


apksignerKeystoreFile - Keystore file
Input alias: keystoreFile. string. Required when apksign = true.

The file path to the Android Keystore file that is used to sign the APK. This file must be uploaded to the secure files library, where it is securely stored with encryption. The Android Keystore file is removed from the agent machine when the pipeline completes.

The file can either be checked into source control or placed on the build machine directly by an administrator. It is recommended to encrypt the keystore file in source control and use the Decrypt File task to decrypt the file during the build.


apksignerKeystorePassword - Keystore password
Input alias: keystorePass. string. Optional. Use when apksign = true.

The key password for the provided Android Keystore file.

Important

Use a new variable with its lock enabled on the Variables pane to encrypt this value. See secret variables.


apksignerKeystoreAlias - Alias
Input alias: keystoreAlias. string. Optional. Use when apksign = true.

The alias that identifies the public/private key pair to be used in the Android Keystore file.


apksignerKeyPassword - Key password
Input alias: keyPass. string. Optional. Use when apksign = true.

The key password for the alias and keystore file.

Important

Use a new variable with its lock enabled on the Variables pane to encrypt this value. See secret variables.


apksignerVersion - apksigner version
string. Optional. Use when apksign = true. Default value: latest.

The Android SDK build-tools version that the apksigner executable uses for the task.


apksignerArguments - apksigner arguments
string. Optional. Use when apksign = true. Default value: --verbose.

Provides options to pass to the apksigner command line. See the apksigner documentation.


apksignerFile - apksigner location
Input alias: apksignerLocation. string. Optional. Use when apksign = true.

Specifies the location of the apksigner executable used during signing. This defaults to the apksigner found in the Android SDK version folder that your application builds against.


zipalign - Zipalign
boolean. Default value: true.

Select if you want to zipalign your package. This reduces the amount of RAM consumed by an app.


zipalignVersion - Zipalign version
string. Optional. Use when zipalign = true. Default value: latest.

The Android SDK build-tools version that the zipalign executable uses for the task.


zipalignFile - Zipalign location
Input alias: zipalignLocation. string. Optional. Use when zipalign = true.

Specifies the location of the zipalign executable used during signing. This defaults to the zipalign found in the Android SDK version folder that your application builds against.


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.

Remarks

Use this task in a pipeline to sign and align Android APK files.

This version of the task uses apksigner instead of jarsigner to sign APKs.

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: JDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: Setting variables is disabled
Agent version 2.182.1 or greater
Task category Build
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: JDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.116.0 or greater
Task category Build
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: JDK, AndroidSDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.116.0 or greater
Task category Build