The multi-channel packaging described in this article is based on the AU statistical implementation.
Steps for multi-channel packaging:
1. Setting dynamic channel variables in Androidmanifest.xml
<meta-data
Android:name= "Umeng_channel"
Android:value= "${umeng_channel_value}"/>
2. Set productflavors in Build.gradle
Batch modification is used here:
Android {
productflavors {
Default_channel {}
QQ {}
Weixin {}
WEIBO {}
Wandoujia {}
_360 {}
Yingyongbao {}
Xiaomi {}
Baidu {}
Huawei {}
Jifeng {}
}
Productflavors.all {Flavor
Flavor.manifestplaceholders = [Umeng_channel_value:name]
}
}
The so-called productflavors is actually a definable product feature, and when used with manifest merger, it is possible to achieve multiple versions with their own feature configurations during a single compilation. The function of the above configuration is to produce different umeng_channel_value values for each channel package.
3. Packing operation
Here are two methods:
Only graphical interface operations are described here.
In the Androidstudio menu bar, click the Build menu –>generate signed apk–> Select key and enter the password
Then next, select the packaging channel (multiple options available)
Finally click the Finish button
As you can see, we have successfully set up three channel packs.
Android Studio Multi-channel packaging