Android Studio Gradle multi-channel packaging

Source: Internet
Author: User

In order to count the data of each channel, such as download quantity, it is necessary to package for different channels. It's now packaged with Ant, and it feels like it's time to replace it.

Start Packing:

1. Write the following paragraph in the Androidmanifest.xml placeholder

< Meta-data             Android:name = "ChannelName"             android:value= "${channelname}"/>

2. Build.gradle settings in the app Productflavors

productflavors {        Wandoujia {            manifestplaceholders = [channelname: "Wandoujia"]        }        Baidu {            Manifestplaceholders = [ChannelName: "Baidu"]        }        c360 {            manifestplaceholders = [channelname: "c360"]        }        UC {            manifestplaceholders = [channelname: "UC"]        }    }

The default channel name, which we can define in Defaultconfig

Manifestplaceholders = [ChannelName: "The default channel name you want to define"]

3. Packaging needs to be signed, set up here, as

The following code is generated in Build.gradle when the setup is complete

Signingconfigs {        Config {            keyalias ' your_keyalias '            keypassword ' Your_alias_password '            storefile File (' Your_keystore_path ')            storepassword ' Your_keystore_password '        }    }

4. Run in Android Studio to bring your own terminal execution

Gradlew Assemblerelease

And then just have a glass of water to wait for the package to finish, isn't it convenient?

Android Studio Gradle multi-channel packaging

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.