Use Gradle multi-channel packaging in Android studio

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.