1、
defaultConfig {
//
flavorDimensions "default"
}
2、
android{
productFlavors {
//开发环境
developenv {
buildConfigField "Integer", "ENV_TYPE", "1"
applicationId 'xxx'
manifestPlaceholders = [
app_name: "开发",
]
}
//生产环境
productenv {
buildConfigField "Integer", "ENV_TYPE", "2"
applicationId 'xxx'
manifestPlaceholders = [
app_name: "生产",
]
}
}
}
3、与android{} 同级
configurations {
developenvDebugImplementation
developenvReleaseImplementation
productenvReleaseImplementation
productenvDebugImplementation
}
4、
repositories {
flatDir {
dirs 'libs'
}
}
5、
developenvImplementation project(path: ':xxxlibrary')
6、
参考 :https://blog.csdn.net/helloworld19870427/article/details/83072699