android tutorial - Versioning your builds in Android | Developer android - android app development - android studio - android app developement
Versioning your builds via "version.properties" file
- You can use Gradle to auto-increment your package version each time you build it. To do so create a version.properties file in the same directory as your build.gradle with the following contents:
- (Changing the values for major and minor as you see fit). Then in your build.gradle add the following code to the android section:
- The information can be accessed in Java as a string BuildConfig.VERSION_NAME for the complete {major}.{minor}.{build} number and as an integer BuildConfig.VERSION_CODE for just the build number.