Gradle:如何构建不同构建类型的不同风格? [英] Gradle: How to Build different flavours of different built types?
问题描述
有人能告诉我是否可以通过命令行只构建一种我的不同风格?
Could someone tell me if it's possible to build only one of my different flavors through the command-line?
目前我还没有看到执行的方式,例如:
At the moment I haven't seen the way to execute, for example:
gradle buildDev
当 Dev 是我的不同口味之一时.确实,我必须执行:
when Dev is one of my different flavors. Indeed, I have to execute:
gradle build
并且所有口味都是构建的.
And all flavors are build.
我想跳过一些口味.有可能吗?
I'd like to skip some flavors. is it possible?
谢谢
推荐答案
虽然 build
任务没有特定于风格的版本,但有特定于风格的 assemble
和 install
任务.assemble
将创建 APK;install
会将其安装在设备/模拟器上.
While there is no flavor-specific version of the build
task, there are flavor-specific versions of the assemble
and install
tasks. assemble
will create the APK; install
will install it on devices/emulators.
例如,在这个示例项目中,我定义了两种产品风味(chocolate
和 vanilla
)和三种总构建类型(debug
、release
和 mezzanine
).
For example, in this sample project, I define two product flavors (chocolate
and vanilla
) and three total build types (debug
, release
, and mezzanine
).
Running gradle tasks
显示,其中包括:
Running gradle tasks
shows, among others:
Build tasks
-----------
assemble - Assembles all variants of all applications and secondary packages.
assembleChocolate - Assembles all builds for flavor Chocolate
assembleChocolateDebug - Assembles the Debug build for flavor Chocolate
assembleChocolateDebugTest - Assembles the Test build for the ChocolateDebug build
assembleChocolateMezzanine - Assembles the Mezzanine build for flavor Chocolate
assembleChocolateRelease - Assembles the Release build for flavor Chocolate
assembleDebug - Assembles all Debug builds
assembleMezzanine - Assembles all Mezzanine builds
assembleRelease - Assembles all Release builds
assembleTest - Assembles all the Test applications
assembleVanilla - Assembles all builds for flavor Vanilla
assembleVanillaDebug - Assembles the Debug build for flavor Vanilla
assembleVanillaDebugTest - Assembles the Test build for the VanillaDebug build
assembleVanillaMezzanine - Assembles the Mezzanine build for flavor Vanilla
assembleVanillaRelease - Assembles the Release build for flavor Vanilla
Install tasks
-------------
installChocolateDebug - Installs the Debug build for flavor Chocolate
installChocolateDebugTest - Installs the Test build for the ChocolateDebug build
installChocolateMezzanine - Installs the Mezzanine build for flavor Chocolate
installChocolateRelease - Installs the Release build for flavor Chocolate
installVanillaDebug - Installs the Debug build for flavor Vanilla
installVanillaDebugTest - Installs the Test build for the VanillaDebug build
installVanillaMezzanine - Installs the Mezzanine build for flavor Vanilla
installVanillaRelease - Installs the Release build for flavor Vanilla
uninstallAll - Uninstall all applications.
uninstallChocolateDebug - Uninstalls the Debug build for flavor Chocolate
uninstallChocolateDebugTest - Uninstalls the Test build for the ChocolateDebug build
uninstallChocolateMezzanine - Uninstalls the Mezzanine build for flavor Chocolate
uninstallChocolateRelease - Uninstalls the Release build for flavor Chocolate
uninstallVanillaDebug - Uninstalls the Debug build for flavor Vanilla
uninstallVanillaDebugTest - Uninstalls the Test build for the VanillaDebug build
uninstallVanillaMezzanine - Uninstalls the Mezzanine build for flavor Vanilla
uninstallVanillaRelease - Uninstalls the Release build for flavor Vanilla
这篇关于Gradle:如何构建不同构建类型的不同风格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!