It might happen that you will have multiple flavors of APKs. Usually gradle makes it very easy to select the flavor of the project by putting the flavor name to the specified place in the gradle task’s name.
Here is a simple and easy description of the build types(debug/release) and also there we have a note about build variants:
The “Debug” part in the above task names is just a camel-case version of the build variants name, so it can be replaced with whichever build variant you want to assemble or install. For example, if you have a “demo” product flavor, then you can build the debug version with the assembleDemoDebug task.
Also the configuration of flavors made really quick by gradle:
android {
...
defaultConfig {...}
buildTypes {...}
productFlavors {
demo {
applicationIdSuffix ".demo"
versionNameSuffix "-demo"
}
full {
applicationIdSuffix ".full"
versionNameSuffix "-full"
}
}
}
After you are sure about the flavor you will need, the only thing you need to change on Bitrise will be the gradle-runner step’s gradle task input.
Usually, if you need more than one of your variants in a single build, you can do two things:
- Use one gradle-runner step, with a simple
assembleDebug
(without any flavor, just the type is enough), so it will generate all the flavors, or just list the tasks separated by a space for example:assembleFlavor1Debug assembleFlavor2Debug
- Use multiple gradle-runner step, so you can define the exact flavors you need, for example:
assembleFlavor1Debug
in the first gradle-runner, andassembleFlavor2Debug
in the second, the point of using separated gradle-runner step is that this way the env$BITRISE_APK_PATH
after the gradle-runner step will contain the only flavor just built. For example:/path/to/my/flavor1-debug.apk
and/path/to/my/flavor2-debug.apk
So this way Sign APK and Google Play Deploy steps can automaticall pick up the APK to work with.
Feel free to ask any questions!