Have you thought how to organize the release of your mobile app? Well, I'm having this sort of problem and after Googling I've found a nice way to solve the problem.

The classification MMPB is really abstract. Specially when the point is Major and Minor. It depends basically on business of each company. All the examples are based on my personal experiences and there is not connect with the companies here cited. Let's try to clarify each point of MMPB.

Major

When a new feature that involves a substantially change on the way how the user iterate with the app. Or to release a brand new feature on your app.

Example: If Uber release a new way kind of car, let's say, if you could ask a Truck. This could be a major release.

Also, Uber release a brand new user interface to the customer, this could be considered a Major release.

To a more technical aspect, using RxAndroid to communicate Activities and components instead of the regular way, this is also an example of major release.

Basically, if the change on your app, affect the way how the user interact or there is a new feature related with the main function of the app, it should considered a major release.

Minor

When A new feature not related with the main function of the app has being released.

For instance, if Uber has created a new way to receive money. Let's say, connection with PayPal or any other local payment on a country.

It's a change considered minor. It doesn't affect the way how the main function of the app, which is call a driver to bring you from a point to another of the city but a new satellite feature.

Patch

When We are all perfect developers. QA are for loosers. We develop perfect software, error-free :) . But let's imagine that the app release has a problem on the way how to handle HTTP connection.

It's not frequent but a user has reported this bug. The QA team have identified when it occurs and we, as developers have being fixed the problem.

Considering the gravity of the problem, yet this is nothing new, it's just a bug fix, it should be considered a patch.

Build

A build is exactly what it is: a build. Every time that a developer hits: Command + B this number should be incremented.

Technical Solution

Now that I've described one of good solution to versioning an App, let's take a look on how to do that in an automatic way.

The steps to have that done is:

Create a version.properties file

Change the build.gradle script of the app.

Version.properties

This is simple. Just create a version.properties file at the same directory os your build.gradle of your app with the same content bellow:

VERSION_NAME_MAJOR=1

VERSION_NAME_MINOR=0

VERSION_NAME_PATCH=0

VERSION_NAME_BUILD=0

VERSION_CODE=1

Build.gradle

Open the build.gradle of the your app. Locate the point where the defaultConfig is defined and replace that with the follow snippet:

def versionPropsFile = file('version.properties')



if (versionPropsFile.canRead()) {

def Properties versionProps = new Properties()

versionProps.load(new FileInputStream(versionPropsFile))



//

// versionCode

//

def versionCodeNo = versionProps['VERSION_CODE'].toInteger()

versionProps['VERSION_CODE'] = versionCodeNo.toString()



//

// versionName

//

def versionNameMajor = versionProps['VERSION_NAME_MAJOR'].toInteger()

versionProps['VERSION_NAME_MAJOR'] = versionNameMajor.toString()



def versionNameMinor = versionProps['VERSION_NAME_MINOR'].toInteger()

versionProps['VERSION_NAME_MINOR'] = versionNameMinor.toString()



def versionNamePatch = versionProps['VERSION_NAME_PATCH'].toInteger()

versionProps['VERSION_NAME_PATCH'] = versionNamePatch.toString()



def versionNameBuild = versionProps['VERSION_NAME_BUILD'].toInteger() + 1

versionProps['VERSION_NAME_BUILD'] = versionNameBuild.toString()





versionProps.store(versionPropsFile.newWriter(), null)



defaultConfig {

applicationId "br.com.mapsrx"

minSdkVersion 16

targetSdkVersion 23

versionCode versionCodeNo

versionName versionNameMajor + "." + versionNameMinor + "," + versionNamePatch + "." + versionNameBuild

}

} else {

throw new GradleException("Could not read version.properties!")

}

Conclusion

Open the version.properties on the editor. Build the app (Command + B) and see the changes on entry: VERSION_NAME_BUILD.

The others variables such as: Major, Minor and Patch has to be changed by hand on version.properties file. If you would like any more sophisticated way how increate the variables it's just follow the same rule as used on VERSION_NAME_BUILD.

Enjoy!