In my gradle(app) file, I am setting the Product flavor and build type as shown below
productFlavors {
mock {
}
develop {
}
qa {
}
staging {
}
prod {
}
}
buildTypes {
debug {
//signingConfig signingConfigs.release
}
release {
minifyEnabled false
//signingConfig signingConfigs.release
}
In Android studio build variants, I get the following options based on the above:
I have put a code in my app to print the current running Build variant as below. But the below code always print empty. Why is this so? How can I get the exact build variant inside my app? Any help is much appreciated.
System.out.println("Current build variant is"+BuildConfig.FLAVOR);
You probably imported the wrong BuildConfig. Check your imports and see if it is:
import <your_package_name>.BuildConfig;
and NOT something like:
import android.support.v4.BuildConfig;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With