public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "xxx.xxxxxxxx.xxx";
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 = "1.0.0";
// Fields from build type: debug
public static final String ACCESS_PARAMS = "YOUR_VALUE";
}
2条答案
按热度按时间1szpjjfi1#
在根目录中创建一个文件,例如:apikey.properties
在您的build.gradle中阅读apikey.properties
可以使用
BuildConfig
对象访问中的字段。nkoocmlb2#
1.在
gradle.properties
中写入代码1.将代码写入应用程序级别
build.gradle
1.生成的BuildConfig.java如下: