在app gradle 文件android {}标签中加入
flavorDimensions"versionCode"
//多渠道配
productFlavors {
//设置百度应用市场渠道名为baidu
baidu {
manifestPlaceholders = [TALK_DATA_VALUE:"baidu "]
}
//设置360应用市场渠道名为360
ali {
manifestPlaceholders = [TALK_DATA_VALUE:"ali"]
}
//设置wandoujia 应用市场渠道名为wandoujia
tecent {
manifestPlaceholders = [TALK_DATA_VALUE:"tecent "]
}
oppo {
manifestPlaceholders = [TALK_DATA_VALUE:"oppo "]
}
vivo {
manifestPlaceholders = [TALK_DATA_VALUE:"vivo "]
}
huawei {
manifestPlaceholders = [TALK_DATA_VALUE:"huawei "]
}
webdownload {
manifestPlaceholders = [TALK_DATA_VALUE:"webdownload "]
}
upgrade {
manifestPlaceholders = [TALK_DATA_VALUE:"upgrade "]
}
就可以了。
在manifest中设置统计的名字:
android:name="TD_CHANNEL_ID" android:value="${TALK_DATA_VALUE}" /> 就好了。