You finished your app, tested on debug mode and it is working perfect. Now, you want to prepare it to publish in the Google Play Store.
Xamarin documentation provides good informations in here:
Android Manifest
First, in Visual Studio, right-click your Xamarin.Android project in the Solution Explorer and select Properties. Then, go to the Android Manifest tab, to see this screen:
Unlike in Android Studio or Eclipse, you don't need the set the AndroidManifest.xml file by writing; Xamarin and Visual Studio do that for you. Activities, BroadcastReceivers and Services are inserted into Android Manifest by declaring specific attributes in their classes.
In this screen, the options are:
Android Options
In the screen below, you can configure the compiler options. Using the right options here can reduce a lot your APK size and also prevent errors.
Xamarin.Linker may sometimes remove classes that are not seemed to be used by your code, especially if they are in the project's Core (PCL library). To avoid that, you can either set the Linking to "Sdk Assemblies Only" or use the Preserve attribute in your classes, example:
PreserveAttribute.cs
namespace My_App_Core.Models
{
public sealed class PreserveAttribute : System.Attribute
{
public bool AllMembers;
public bool Conditional;
}
}
In a class:
using System;
namespace My_App_Core.Models
{
[Preserve(AllMembers = true)]
public class ServiceException : Exception
{
public int errorCode;
[Preserve(AllMembers = true)]
public ServiceException() { }
[Preserve(AllMembers = true)]
public ServiceException(int errorCode)
{
this.errorCode = errorCode;
}
}
}
After configuring everything, Rebuild the Project to make sure that it builds successfully.
Creating the APK for Release mode
You finished configuring your Android project for Release. The tutorial below shows how to generate the APK in Visual Studio. A full tutorial from Xamarin documentation can be found here:
To create the APK file, right-click the Xamarin.Android project in the Solution Explorer and select Archive...
This will open the Archive manager and begin archiving the project, preparing to create the APK file.
When it finishes archiving the project, click in Distribute... to proceed.
The Distribute screen will present you two options: Ad-hoc and Google Play. The first will create an APK and save it in your computer. The second will directly publish the app in Google Play.
Choosing the first is recommended, so you can test the APK in other devices if you want.
In the following screen, an Android Key Store is needed to sign the APK. If you already have one, you can use it by clicking in Import...; if you don't, you can create a new Android Key Store by clicking in +.
Creating a new Android Key Store screen:
To create the APK, click in Save As. You may be prompted to type the Key Store password.
When it completes, you can click in Open Folder on the Archives screen to see your generated APK file.