Trying to use Gradle in Android studio to hit multi-channel packages is as magical as it is legendary. Part of this article is to refer to the content on Google, right when the study record here
1, configure the channel information in the Androidmanifest.xml, here to the Friends of the league statistics as an example bar
Add in the <application> ... </application> node:
<meta-data android:name= "Umeng_channel" android:value= "${umeng_channel_value}" ></meta-data>
Note here, the past VALUE is filled in the name of the channel, such as pea pod can be filled Wandoujia, but here with ${umeng_channel_value} instead, can be understood as a variable, the following will be used;
2. In the module corresponding to the packaging programthe Build.gradle:
The following modifications are made:In the android{...} Added inside:
productflavors{ wandoujia{} qihu360{} baidu{} xiaomi{} uc{} productflavors.all{ Flavor->flavor.manifestplaceholders = [Umeng_channel_value:name] } }
One of the wandoujia{}, qihu360{} ... These are the channel names needed, and here's theUmeng_channel_value is for us inThe value that configures the channel information in the Androidmanifest.xml, adds these things and builds it .Item:
After the success,one step;
3, configure the GRADLE environment variable, add the bin file path in the Gradle to the path;
4, then how to sign packaging it? Choose Build->generate signed APK ...
Then fill in the signature password and so on, then you can see this:
Select all flavors those options, and then finish. OK, in the module directory you can see the name of the APK,
Use Gradle multi-channel packaging in Android studio