一个工程打包多个应用
利用gradle的productFlavors编译时动态配置,实现打包时配置不同的参数
productFlavors {
// 定制1
appcustom01 {
applicationId "com.custom01" //自身的applicationId
resValue "string", "app_name", "某某通话1" //自动创建对应的string,无需到string里面单独定义
buildConfigField 'String', 'type', '"appcustom01"'//BuildConfig.type;方式,代码中引用
manifestPlaceholders = [app_icon : "@mipmap/ic_rank_first", //manifest中android:icon="${app_icon}"方式引用
app_roundicon: "@mipmap/ic_rank_first",
map_appkey : "xxxxxxxxxxxxx"]
}
// 定制2
appcustom01 {
applicationId "com.custom02"
resValue "string", "app_name", "某某通话1"
buildConfigField 'String', 'type', '"appcustom01"'
manifestPlaceholders = [app_icon : "@mipmap/ic_rank_first", app_roundicon: "@mipmap/ic_rank_first", map_appkey : "xxxxxxxxxxxxx"]
}
}