本文介绍了同时部署多个生成的变种 - Android电子的gradle工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发现的gradle关于这个productFlavors真棒功能。我现在有3变种(分期,沙箱和生产),我可以通过构建变量面板在同一时间部署变种。

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?

推荐答案

是的,
在Android Studio中,打开任务摇篮选项卡上,这通常是在右边。你会看到,以组装,在其中的一个双击启动许多任务。

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.

例如,在assembleRelease双击将创建所有版本的apk。

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

从文档:

建设和任务

我们previously看到,每个生成类型创建自己组装
  任务,但构建变体是生成类型的组合,并且
  产品风味。

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)组装[变体名称]

1) assemble[Variant Name]

2)组装[构建类型名称]

2) assemble[Build Type Name]

3)组装[产品名称风味]

3) assemble[Product Flavor Name]

1)允许直接建立一个单一的变体。例如
  assembleFlavor1Debug。

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

2),就可以建立一个给定生成类型所有的APK。例如
  assembleDebug将建立两个Flavor1Debug和Flavor2Debug变种。

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

3)允许建立一个给定的味道所有的APK。例如
  assembleFlavor1将建立两个Flavor1Debug和Flavor1Release
  变种。

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.

这篇关于同时部署多个生成的变种 - Android电子的gradle工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 16:05