Gradle 풍미 만 빌드
누군가가 명령 줄을 통해 내 다른 버전 중 하나만 빌드 할 수 있는지 말해 줄 수 있습니까?
현재로서는 실행 방법을 보지 못했습니다. 예를 들면 다음과 같습니다.
gradle buildDev
Dev가 내 다른 맛 중 하나 일 때. 실제로 다음을 실행해야합니다.
gradle build
그리고 모든 맛이 만들어졌습니다.
몇 가지 맛을 건너 뛰고 싶습니다. 가능할까요?
감사
build
작업 의 특징 별 버전은 없지만 assemble
및 install
작업 의 특징 별 버전이 있습니다. assemble
APK를 생성합니다. install
장치 / 에뮬레이터에 설치합니다.
예를 들어,에 이 샘플 프로젝트 , 내가 두 제품의 맛 (정의 chocolate
와 vanilla
)과 총 3 개 빌드 유형을 ( 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
I would simplify the answer given by @CommonsWare because going through the answer i was litte confused.
Consider these are the product flavours
- Dev
- Preprod
- Prod
Run
gradlew task
This will list out all Product flavours along with there build types
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.
From this you can easily choose the flavours and will generate a build based on that
gradlew assemblePREPROD
If your productFlavor is chocolate you can do
./gradlew assembleChocolateRelease
or
./gradlew assembleChocolateDebug
참고URL : https://stackoverflow.com/questions/21307444/gradle-build-only-a-flavour
'development' 카테고리의 다른 글
리플렉션을 통해 공개 정적 필드의 값 가져 오기 (0) | 2020.10.07 |
---|---|
mysql을 사용하여 쿼리 결과를 변수에 저장하는 방법 (0) | 2020.10.07 |
큰 따옴표로 묶인 문자열에서 객체의 속성을 어떻게 사용할 수 있습니까? (0) | 2020.10.07 |
2014 년 12 월 31 일로 설정된 new Date () 대신 12 월 1 일이 표시됨 (0) | 2020.10.06 |
코드 숨김에 정의 된 바인딩 개체 (0) | 2020.10.06 |