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