Android signing task

Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS 2015

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

Demands

The build agent must have the following capabilities:

  • Java JDK

YAML snippet

# Android signing
# Sign and align Android APK files
- task: AndroidSigning@3
  inputs:
    #apkFiles: '**/*.apk' 
    #apksign: true # Optional
    #apksignerKeystoreFile: # Required when apksign == True
    #apksignerKeystorePassword: # Optional
    #apksignerKeystoreAlias: # Optional
    #apksignerKeyPassword: # Optional
    #apksignerArguments: '--verbose' # Optional
    #apksignerFile: # Optional
    #zipalign: true # Optional
    #zipalignFile: # Optional

Arguments

Argument Description
apkFiles

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
Signing Options
apksign Select this option to sign 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 Select or enter the file name of the Android Keystore file that should be 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 will be used to sign the APK, but will be removed from the agent machine when the pipeline completes.
apksignerKeystorePassword

Enter the 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 Enter the alias that identifies the public/private key pair to be used in the keystore file.
apksignerKeyPassword Enter the key password for the alias and Android Keystore file.
Important: Use a new variable with its lock enabled on the Variables pane to encrypt this value. See secret variables.
apksignerArguments

(Optional) Provide any options to pass to the apksigner command line. Default is: --verbose.

See the apksigner documentation.

apksignerFile

(Optional) Optionally specify 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 Options
zipalign

(Optional) Select if you want to zipalign your package. This reduces the amount of RAM consumed by an app. The default is true.

zipalignFile

(Optional) Optionally specify 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.

Control options

Android Build