Versioning of Android app (Dev, Stage, and Prod) using same code base – Xamarin Forms

We will be continuing our journey into App versioning, this time for Android. Similar to iOS, in Android, we have to create Compiler symbols too. For those who have missed iOS versioning blog, click on below is the link.
Versioning of iOS app (Dev, Stage, and Prod) using same code base – Xamarin Forms

Set different configurations

Similar to iOS, setup all the required configurations as shown below,

Dev

Screen Shot 2018-04-28 at 12.42.35 am.png

Staging

Screen Shot 2018-04-28 at 12.43.26 am.png

Prod

Screen Shot 2018-04-28 at 12.54.45 am.png

Compiler symbols options

Double-clicking on Android project should prompt with Project Options, go to compiler tab under Build section. Here similar to iOS add symbols Dev, Stage, and Prod.

Dev

Screen Shot 2018-04-28 at 12.55.44 am.png

Staging

Screen Shot 2018-04-28 at 12.55.54 am.png

Prod

Screen Shot 2018-04-28 at 12.56.01 am.png

Android Manifest file

In case of Android, we need to create new Manifest files to support creating different apps. Two things to change in this file are package and android: label, as shown below for Dev.

Screen Shot 2018-04-27 at 3.53.10 pm.png

Staging

Screen Shot 2018-04-27 at 3.54.08 pm.png

Prod

Screen Shot 2018-04-28 at 12.39.06 am

Edit Android Proj file

Screen Shot 2018-04-28 at 12.58.34 am.png
Screen Shot 2018-04-28 at 1.00.22 am.png

Now we have to assign in proj file to set each environment with the correct android manifest file, as shown below.
Open proj file using the path

Now change each configuration setting as shown below with the correct Android settings with appropriate Android Manifest file.

Finally

Screen Shot 2018-04-28 at 10.08.58 am.png

Remove Label from the main activity, so the app picks up the name from required Android Manifest file.

Output

Screen Shot 2018-04-28 at 12.37.45 am

When we run with above configurations, it will create different apps for the same code base

Dev

Screen Shot 2018-04-28 at 1.03.41 am.png

Staging

Screen Shot 2018-04-28 at 1.03.56 am.png

Prod

Screen Shot 2018-04-28 at 1.04.13 am.png


Github link
https://github.com/divikiran/AppVersioning

Advertisement

Posted

in

by

Tags:

Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: