Generate build using build variant in android

Hi @usmanafzal,

Thanks for asking this here! :slight_smile:

You can run / specify the flavor specific Gradle Task, every flavor should have e.g. an assembleX task which can be run as a gradle task:

You can set the Gradle task as the Gradle task to run option of the Gradle Runner step.

You can get the full list of tasks you can run with gradle on your project with: gradle tasks
( source & more info: http://devcenter.bitrise.io/android/android-tips-and-tricks/#what-are-gradle-tasks-and-how-can-i-get-the-list-of-available-tasks-in-my-project )

Just create corresponding workflows, or use Workflow Environment Variables for beta, staging, production, … and specify the Triggers when to run which workflow: Using the Trigger Map to trigger builds - Bitrise Docs

A very minimal (not complete, only for demonstration!) example:

format_version: 1.3.1
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
trigger_map:
- push_branch: master
  workflow: release
- push_branch: '*'
  workflow: beta
- pull_request_source_branch: '*'
  workflow: beta
workflows:
  beta:
    steps:
    - gradle-runner@1.5.4:
        inputs:
        - gradle_task: assembleOne
  release:
    steps:
    - gradle-runner@1.5.4:
        inputs:
        - gradle_task: assembleTwo

This configuration will select the release workflow for pushes on the master branch, and for pushes on any other branch and for Pull Requests it’ll select the beta workflow.

The beta workflow’s gradle runner step will run the assembleOne gradle task, while the release workflow’s gradle runner will run the assembleTwo task.


If you have any questions just let us know!
Happy Building! :wink: