Xamarin.Android task

Azure Pipelines | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 - TFS 2015

Use this task to build an Android app with Xamarin.


AndroidSDK, MSBuild, Xamarin.Android

YAML snippet

# Xamarin.Android
# Build an Android app with Xamarin
- task: XamarinAndroid@1
    #projectFile: '**/*.csproj' 
    #target: # Optional
    #outputDirectory: # Optional
    #configuration: # Optional
    #createAppPackage: true # Optional
    #clean: false # Optional
    #msbuildLocationOption: 'version' # Optional. Options: version, location
    #msbuildVersionOption: '15.0' # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0
    #msbuildFile: # Required when msbuildLocationOption == Location
    #msbuildArchitectureOption: 'x86' # Optional. Options: x86, x64
    #msbuildArguments: # Optional
    #jdkOption: 'JDKVersion' # Options: jDKVersion, path
    #jdkVersionOption: 'default' # Optional. Options: default, 1.11, 1.10, 1.9, 1.8, 1.7, 1.6
    #jdkDirectory: # Required when jdkOption == Path
    #jdkArchitectureOption: 'x64' # Optional. Options: x86, x64


Argument Description
(Required) Relative path from repo root of Xamarin.Android project(s) to build. Wildcards can be used more information.
For example, **/*.csproj for all csproj files in all subfolders. The project must have a PackageForAndroid target if Create App Package is selected.
Default value: **/*.csproj
Argument aliases: projectFile
(Optional) Build these targets in this project. Use a semicolon to separate multiple targets.
Output Directory
Optionally provide the output directory for the build.
Example: $(build.binariesDirectory)/bin/Release
Argument aliases: outputDirectory

(Optional) Specify the configuration you want to build such as debug or release.

Tip: Declare a build variable such as BuildConfiguration on the Variables tab (selecting Allow at Queue Time) and reference it here as $(BuildConfiguration). This way you can modify the platform when you queue the build and enable building multiple configurations.

Create app package
(Optional) Passes the target (/t:PackageForAndroid) during build to generate an APK.
Default value: true
(Optional) Passes the clean target (/t:clean) during build
Default value: false
MSBuild Options
(Optional) Path to MSBuild (on Windows) or xbuild (on macOS). Default behavior is to search for the latest version.
Default value: version
Argument aliases: msbuildLocationOption
MSBuild version
(Optional) If the preferred version cannot be found, the latest version found will be used instead. On macOS, xbuild (Mono) or MSBuild (Visual Studio for Mac) will be used.
Default value: 15.0
Argument aliases: msbuildVersionOption
MSBuild location
(Required) Optionally supply the path to MSBuild (on Windows) or xbuild (on macOS)
Default value: version
Argument aliases: msbuildFile
MSBuild architecture
Optionally supply the architecture (x86, x64) of MSBuild to run
Default value: x86
Argument aliases: msbuildArchitectureOption
Additional Arguments
(Optional) Additional arguments passed to MSBuild (on Windows) or xbuild (on macOS).
JDK Options
Select JDK to use for the build
(Required) Pick the JDK to be used during the build by selecting a JDK version that will be discovered during builds or by manually entering a JDK path.
  • JDK Version: Select the JDK version you want to use.
  • JDK Path: Specify the path to the JDK you want to use.

Default value: JDKVersion
Argument aliases: jdkOption
JDK version
(Optional) Use the selected JDK version during build.
Default value: default
Argument aliases: jdkVersionOption
JDK path
(Required) Use the selected JDK version during build.
Default value: default
Argument aliases: jdkDirectory
JDK Architecture
Optionally supply the architecture (x86, x64) of JDK
Default value: x64
Argument aliases: jdkArchitectureOption
Control options


Build your Xamarin app

Open source

This task is open source on GitHub. Feedback and contributions are welcome.


Do I need an agent?

You need at least one agent to run your build or release.

I'm having problems. How can I troubleshoot them?

See Troubleshoot Build and Release.

I can't select a default agent pool and I can't queue my build or release. How do I fix this?

See Agent pools.

My NuGet push task is failing with the following error: "Error: unable to get local issuer certificate". How can I fix this?

This can be fixed by adding a trusted root certificate. You can either add the NODE_EXTRA_CA_CERTS=file environment variable to your build agent, or you can add the NODE.EXTRA.CA.CERTS=file task variable in your pipeline. See Environment variables for more details.

I use TFS on-premises and I don't see some of these features. Why not?

Some of these features are available only on Azure Pipelines and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.