有人能告诉我,如果有可能通过命令行来我只不同口味的一个建?
目前,我还没有看到执行,例如方式:
gradle buildDev
当开发是我的不同口味之一。 事实上,我必须执行:
gradle build
和所有的口味都构建。
我想跳过一些味道。 可能吗?
谢谢
有人能告诉我,如果有可能通过命令行来我只不同口味的一个建?
目前,我还没有看到执行,例如方式:
gradle buildDev
当开发是我的不同口味之一。 事实上,我必须执行:
gradle build
和所有的口味都构建。
我想跳过一些味道。 可能吗?
谢谢
虽然是没有具体的味道版本build
任务,还有具体的味道版本assemble
和install
任务。 assemble
将创建APK; install
将在设备/模拟器安装。
例如,在此示例项目 ,我定义了两个产品的口味( chocolate
和vanilla
)和三个总建筑类型( debug
, release
和mezzanine
)。
运行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
我将简化由@CommonsWare给出的答案,因为经历了答案,我是豆蔻困惑。
考虑这些产品的口味
跑
gradlew任务
这将列出所有产品的口味以及有生成类型
assemble - Assembles all variants of all applications and secondary packages.
assembleAndroidTest - Assembles all the Test applications.
assembleDebug - Assembles all Debug builds.
assembleDEV - Assembles all DEV builds.
assemblePREPROD - Assembles all PREPROD builds.
assemblePROD - Assembles all PROD builds.
assembleRelease - Assembles all Release builds.
从此,你可以轻松地选择香精将基于一个构建
gradlew assemblePREPROD
如果您productFlavor是巧克力,你可以做
./gradlew assembleChocolateRelease
要么
./gradlew assembleChocolateDebug