Xamarin.Android task

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

Use this task to build an Android app with Xamarin.

Demands

AndroidSDK, MSBuild, Xamarin.Android

YAML snippet

# Xamarin.Android
# Build an Android app with Xamarin
- task: XamarinAndroid@1
  inputs:
    #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, 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

Arguments

Argument Description
project
Project
(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
target
Target
(Optional) Build these targets in this project. Use a semicolon to separate multiple targets.
outputDir
Output Directory
Optionally provide the output directory for the build.
Example: $(build.binariesDirectory)/bin/Release
Argument aliases: outputDirectory
configuration
Configuration

(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.

createAppPackage
Create app package
(Optional) Passes the target (/t:PackageForAndroid) during build to generate an APK.
Default value: true
clean
Clean
(Optional) Passes the clean target (/t:clean) during build
Default value: false
MSBuild Options
msbuildLocationMethod
MSBuild
(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
msbuildVersion
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
msbuildLocation
MSBuild location
(Required) Optionally supply the path to MSBuild (on Windows) or xbuild (on macOS)
Default value: version
Argument aliases: msbuildFile
msbuildArchitecture
MSBuild architecture
Optionally supply the architecture (x86, x64) of MSBuild to run
Default value: x86
Argument aliases: msbuildArchitectureOption
msbuildArguments
Additional Arguments
(Optional) Additional arguments passed to MSBuild (on Windows) or xbuild (on macOS).
JDK Options
jdkSelection
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
jdkVersion
JDK version
(Optional) Use the selected JDK version during build.
Default value: default
Argument aliases: jdkVersionOption
jdkUserInputPath
JDK path
(Required) Use the selected JDK version during build.
Default value: default
Argument aliases: jdkDirectory
jdkArchitecture
JDK Architecture
Optionally supply the architecture (x86, x64) of JDK
Default value: x64
Argument aliases: jdkArchitectureOption
Control options

Example

Build your Xamarin app

Open source

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

FAQ

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.

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.