Deploying multiple build variants at a time - Android studio gradle

最后都变了- 提交于 2019-12-10 15:57:50

问题


I recently discovered this awesome feature about gradle productFlavors. I currently have 3 variants (staging, sandbox and production) and I can deploy one of the variants at a time using build variant panel.

Is there a way I can deploy all variants at a time?


回答1:


Yes, In Android Studio, open the "Gradle Tasks" tab, which is usually on the right. You will see many tasks that start with 'assemble', double click on one of those.

For example, double clicking on 'assembleRelease' will create all your release apks.

From the docs:

Building and Tasks

We previously saw that each Build Type creates its own assemble task, but that Build Variants are a combination of Build Type and Product Flavor.

When Product Flavors are used, more assemble-type tasks are created. These are:

1) assemble[Variant Name]

2) assemble[Build Type Name]

3) assemble[Product Flavor Name]

1) allows directly building a single variant. For instance assembleFlavor1Debug.

2) allows building all APKs for a given Build Type. For instance assembleDebug will build both Flavor1Debug and Flavor2Debug variants.

3) allows building all APKs for a given flavor. For instance assembleFlavor1 will build both Flavor1Debug and Flavor1Release variants.

The task assemble will build all possible variants.



来源:https://stackoverflow.com/questions/24648470/deploying-multiple-build-variants-at-a-time-android-studio-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!