android - Gradle:如何构建不同构建类型的不同风格?

有人可以告诉我是否可以通过命令行仅构建我的不同风格中的一种?

目前我还没有看到执行的方式,例如:

gradle buildDev 

当 Dev 是我的不同风格之一。确实,我必须执行:

gradle build

所有的味道都是建立起来的。

我想跳过一些口味。 有可能吗?

谢谢

最佳答案

虽然 build 任务没有特定风格的版本,但 assembleinstall 任务有特定风格的版本。 assemble 将创建 APK; install 会将其安装在设备/模拟器上。

例如,在 this sample project ,我定义了两种产品风格(chocolatevanilla)和三种总构建类型(debugrelease夹层)。

运行 gradle tasks 显示,除其他外:

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

https://stackoverflow.com/questions/21307444/

相关文章:

php - 错误构建 : fatal error: pcre. h:没有这样的文件或目录

go - go build 是什么意思? (去构建与去安装)

android - 如何在 Android Gradle 中自动增加 versionCode

build - 使用 msbuild 复制所有文件和文件夹

javascript - 使用 Webpack 基于环境的条件构建

shell - 运行 shell 脚本时如何在 Jenkins 中将构建标记为不稳定

android - 错误 :(6, 0) 未找到 Gradle DSL 方法: 'google()'

javascript - webpack中的XX个隐藏模块是什么意思

xcode - 如何在 Xcode 中启用构建时间?

java - 如何在 Eclipse 中更新 Maven 存储库?