多渠道打包
2020-07-29 本文已影响0人
XiaoXred
1.必须要首先在清单配置文件配置一下
<meta-dataandroid:name="UMENG_CHANNEL
"android:value="${CHANNEL_VALUE}"/>
2. 在app的build.gradle的android{}中添加如下内容:
android {
flavorDimensions "default"
productFlavors {
baidu {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "baidu "]
}
_360 {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "_360 "]
}
oppo {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "oppo"]
}
huawei{
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "huawei"]
}
}
}
3.Gradle后如果出现如下报错
则需要配置flavor dimension的维度是该版本号,这样维度就是都是统一的了
build {
defaultConfig {
flavorDimensions "versionCode"
}
}
4.编译打包
Build - Generate Signed Bundle or APK - 选择Release或Debug