Android BuildConfig.VERSION_ Name returned null?
•
Android
I want to display my version name on the login screen, but it always returns null. I defined my versionname in the gradle build of my application, as follows:
defaultConfig {
applicationId "com.maplesyrupindustries.j.airportmeet"
minSdkVersion 19
targetSdkVersion 24
versionCode 7
versionName "1.0.6"
multiDexEnabled true
}
I call it in the login onCreate:
String build = BuildConfig.VERSION_NAME;
Log.e(TAG,BuildConfig.VERSION_NAME);
tvVersion.setText("Alpha " + build);
However, the build string is always empty. What gives?
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码