Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best practice to manage the version of my android app?

Tags:

android

Actually my app is nearly so far, that some people can test it. Now I want to a version number for the app. Where should I put the the version.properties or is there a built-in mechanism?

Thanks

like image 231
Al Phaba Avatar asked Dec 18 '12 18:12

Al Phaba


2 Answers

As to best practices, you can use a very nice approach to manage version code and name described here https://plus.google.com/+JakeWharton/posts/6f5TcVPRZij by Jake Wharton.

Basically, you can update your build.gradle to generate versionCode and versionName based on your major, minor and patch version numbers. (Code copied from the link for convenience.)

def versionMajor = 3
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0 // bump for dogfood builds, public betas, etc.

android {
  defaultConfig {
    ...
    versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
    versionName "${versionMajor}.${versionMinor}.${versionPatch}"
    ...
  }
  ...
}
like image 130
GregoryK Avatar answered Sep 18 '22 18:09

GregoryK


Inside your Manifest you should have this:

 android:versionCode="1"
 android:versionName="1.0" 
like image 20
Ahmad Avatar answered Sep 21 '22 18:09

Ahmad