如何在运行时在 Android Studio 中获取构建变体?
问题描述:
我想在运行时获取构建变体,这可能不需要任何额外的配置或代码吗?
I'd like to get the build variant during runtime, is this possible without any extra config or code?
答
查看生成的 BuildConfig
类.
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.app";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "";
}