andreluizreis
5/29/2017 - 3:46 PM

Get Build Version and Name

Get Build Version and Name

import com.yourpackage.BuildConfig;
...
int versionCode = BuildConfig.VERSION_CODE;
String versionName = BuildConfig.VERSION_NAME;



Also make sure to specify them in your build.gradle file 
instead of the AndroidManifest.xml
defaultConfig {
    versionCode 1
    versionName "1.0"
}