android {
buildTypes {
release {
minifyEnabled true
}
}
但是,在实际的构建类型定义?让说,我想它提交到Git的。我应该怎么做,以保持构建类型的项目是否一致?
这里居然是构建类型定义?
基本上,BuildConfig
是驻留下路径自动生成的类:
应用程序/生成/产生/源极/ buildConfig / yourBuildType / yourPackageName / BuildConfig.java。
此类包含由buildTypes {}
块从应用级的build.gradle文件中提供的变量。因此,在每一个清洁和项目的重建,摇篮自动生成可在进一步的Android开发环境中使用BuildConfig
类。
即BuildConfig.DEBUG
的是,我们可以在应用程序代码中使用,以确定它的buildType
默认变量。
我们可以通过从下像文件的build.gradle提供buildType
我们自己的领域:
android {
. . .
buildTypes {
debug {
buildConfigField "String", "SOME_VARIABLE", '"This string value is from build config class"'
}
}
. . .
}