-
修改AndroidManifest.xml文件,添加渠道名称变量
<!--value的值填写渠道名称,例如yingyongbao。这里设置动态渠道名称变量--> <meta-data android:value="${UMENG_CHANNEL_VALUE}" android:name="UMENG_CHANNEL"/>
-
修改app的build.gradle文件,添加所需要的渠道
/*配置渠道*/ productFlavors { yingyongbao { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "yingyongbao"] } wandoujia { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "wandoujia"] } xiaomi { manifestPlaceholders = [UMENG_CHANNEL_VALUE: "xiaomi"] } }
-
如果遇到一下错误,可以参考google文档修改解决
Error:All flavors must now belong to a named flavor dimension. The flavor 'flavor_name' is not assigned to a flavor dimension.
在build.gradle文件的defaultConfig段落中添加
flavorDimensions "versionCode"
Android 友盟多渠道打包
2020-01-22