Jos*_*hon 81 android build gradle
有人能告诉我是否可以通过命令行只构建我的一种不同口味?
目前我还没有看到执行方式,例如:
gradle buildDev
Run Code Online (Sandbox Code Playgroud)
Dev是我的不同口味之一.的确,我必须执行:
gradle build
Run Code Online (Sandbox Code Playgroud)
所有口味都是建立的.
我想跳过一些口味.可能吗?
谢谢
Com*_*are 140
虽然没有特定于特定风味的版本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
Run Code Online (Sandbox Code Playgroud)
dro*_*kid 26
我会简化@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.
Run Code Online (Sandbox Code Playgroud)
从中您可以轻松选择口味并基于此生成构建
gradlew assemblePREPROD
如果您的产品是巧克力,则可以
./gradlew assembleChocolateRelease
Run Code Online (Sandbox Code Playgroud)
要么
./gradlew assembleChocolateDebug
Run Code Online (Sandbox Code Playgroud)
要添加到上面的答案,如果你想构建一个 Android Bundle (AAB) 那么你可以使用这个
# build flavor 'flavorName' only
./gradlew bundleFlavorName
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
43830 次 |
| 最近记录: |