1.在项目下的build.gradl配置渠道
1.普通版
//android studio 3.0之后才有(才需要加这个flavorDimensions "default")
flavorDimensions "default"
productFlavors {
baidu {
manifestPlaceholders = [CHANNEL_KEY:"baidu"]
}
huawei {
manifestPlaceholders = [CHANNEL_KEY:"huawei"]
}
xiaomi {
manifestPlaceholders = [CHANNEL_KEY:"xiaomi"]
}
googleplay {
manifestPlaceholders = [CHANNEL_KEY:"googleplay"]
}
wandoujia {
manifestPlaceholders = [CHANNEL_KEY:"wandoujia"]
}
}
2.升级版
//android studio 3.0之后才有(才有加flavorDimensions "default")
flavorDimensions "default"
productFlavors {
m360 {
}
googleplay {
}
xiaomi {
}
lenove {
}
huawei {
}
gfan {
}
}
productFlavors.all {
flavor -> flavor.manifestPlaceholders = [CHANNEL_KEY: name]
}
网友评论