Monday, January 7, 2019

4th day with Xamarin

The 3rd day of Xamarin was spent configuring MVVM, Dependency Injection and a Dialog Service in the application. Also, I had a working application for both Android and iOS.

Now, that I have a working app I would like to set up CI/CD for my Android and iOS apps.

I am going to use AppCenter to build and distribute my app. Check out video "Continuous Integration With App Center Build for Xamarin Apps" on Microsoft Developers channel.

You can create a free account on AppCenter but, it will have some restrictions. However, If you are going to use it as an Individual then it should be enough for you.

If you follow the video you should be able to create a project for both Android and iOS project.

Once you create an app, there will be instructions for adding AppCenter analytics and crashes for the application. Follow the instructions for Xamarin.Forms, you would need to switch to the tab with heading Xamarin.Forms.

Once you do that you should be able to see the Analytics in the analytics section. If you run the app in Simulator, you will see something like this

Prepare Android Project For Release

Next, we need to Prepare the Android project for release. Follow the steps mentioned in Microsoft docs 'Preparing an Application for Release'

If you will follow the steps you should be able to prepare your application for release. However, I am going to explain a few things here for which I faced an issue or I think are missing in the document.

Application Icon

Different resolution of devices needs a different resolution of icons. I could not find any link for Android devices. Refer to the default icon in "Resources.mimap" folder to check the resolution of icons for different resolutions.

For iOS refer to the link "Application Icons for Xamarin.iOS".


Linker decided what assemblies/classes/methods are being and used and needs to be included in the package. Read the article 'Using The Linker in Xamarin Projects' to more knowledge about it.

Disable Debug in Release mode

You should not have to do anything. Because there will be code in the MainApplication.cs class in the core project to disable the debugging in the release mode.

Supported CPU Architectures

You might want to change the supported CPU architectures of the application as per your app requirement. You can see the list of supported CPU architectures after clicking Advance button in the Android Options project settings.

By Default single package is created for all the supported CPU architectures. If you select multiple CPU Architectures it is going to increase the size of the package. 

I would suggest reading the article on Generating One package per ABI. If you want to create a separate package for separate CPU architectures.


ProgGuard is Android SDK tool and you can read more about it in the Progaurd section. I did turn it On for my app but I faced multiple build issues and I guess, I would need a custom Proguard configuration file to clear all those warnings and errors. I might write a separate article for this If I need it in the future.


AppCenter will ask for uploading keystore file to sign the application. Follow steps in the article 'Create a new Certificate' to generate keystore file and upload it to AppCenter in the build steps.

Try to build the project in release mode in VS before starting to build on AppCenter. If you can successfully build it in VS you should be able to build it in AppCenter as well.

 If you have configured the build to be distributed to a group then, those Users will receive an email notification whenever a new build will be published. I have set up the distribution of app on 'master' branch. Now, whenever I will merge my code to master branch there will be a new version of the app available for all the test users.

Once it is distributed Users can login to 'HockeyApp' on Android and can see the app and can download it.

Now we have an end 2 end Continous Integration and Deeployment of app for test cycle. I would want to have automated deployment to Google Play store as well once we have the app in good condition.

I will cover iOS in separate article as that needs Apple Developer program enrollment to sign  the application.

No comments:

Post a Comment