How to Build an Android App in Azure DevOps

DevOps Jan 5, 2023

When you start to build an Android App in Xamarin, it is very handy to generate an App File for distribution, but sometimes the delivery time will get faster and you must publish very often new app versions with new features.

Azure DevOps will support you in this case. Let me introduce you, to how we can generate a signed app automatically in Azure DevOps


When you create an APK-Package for the Android world, you will notice that the apk Files must be signed. For this, you must generate a Keystore file. If you have installed Visual Studio on your system with the Xamarin Development environment, you will get this tool installed. So open up a PowerShell Terminal end execute the following command

After you will execute this, you will be prompted by several questions about the publisher like name and so on. But be careful, the parameter alias name will be required later in our pipeline and please be careful about the validity parameter. This will set the days when the Keystore expires, so when this happens, you will be not able to update the app in the google play store.

So here is my output after I execute the command in my shell

If you wonder how I get this nice command line, look at this post.

Now you have a generated Keystore, that you can use to sign the APK-Files.

Store the Keystore in Azure DevOps

Azure DevOps contains a space that store files securely. So that nobody has access to it, except the users/pipelines that are granted.

To store goto Pipelines->Secure files-> + Secure file. You will get then a dialog like this (I already added the files to the upload section)

After you click OK the file is stored. You can then configure the security (who has access to it) and so on.

Next, we must set a variable group

Setup the variables

A variable group is a container for several variables. It contains visible variables and secret variables (hidden by stars).

I added a variable group called andriodApp. In this group, I added the variables

  • KeystoreFile
  • KeyStorePassword
  • KeyStoreAlias

The variable KeystoreFile is the name of the secure File, that we uploaded before. The KeystorePassword variable contains the associated password to the KeyStore. The alias name, that we defined before, ist stored in the KeyStoreAlias variable.

Now that we have set the common variables that we can use, we can create our pipeline for building the apk file.

Create the Pipeline

I will skip the part to generate an empty YAML Pipeline because this is very intuitive and there are several howtos on the net that describe this better than me ;).

So I use the following pipeline:

You see that at the top we define on which branch the pipeline will trigger and which variable group it must use. Next to it there comes up the deployment steps. These will download the Keystore file we uploaded before. After restoring the required NuGet packages, it will compile the solution and generate the apk package.

Now the important part, the next step will sign the apk package against the Keystore.  The rest is only the upload to the artifact store and nothing more. After all, these Packages is ready to use.


With this simple HowTo, you are able to create a pipeline that will compile and deploy an android APK-File. In my other post about generating an ios Package you will see, that is not very different from that process. Sure Xamarin is not very popular, but it helps out in some cases.