For Android, we can use Gradle to:
- Determine which resources to use and for which build flavor
- Determine which configuration parameters to use for each build type
- Build the app for each variant
- Sign the app
Download or clone the sample project from https://github.com/mikerworks/packt-lean-mobile-app-development.
Or, more specifically check out https://github.com/mikerworks/packt-lean-android-build-variants.
When we look at the build.gradle file (inside the app folder) of the sample Android app, it has a couple of sections that define how to deal with different product flavors. Although it is sufficient to just define the flavors and keep the debug and release build types for your project, the sections in the example project might prove useful to examine.
The sample project has a blue and green version, with a test and a production endpoint. Each configuration...