Visit Sponsor

Written by 4:33 pm Android

Continuous Integration for Android Using Bamboo

Overview

Continuous Integration (CI) is a software engineering practice in which developers frequently integrate code into a shared repository. Each integration is verified by an automated build and test process. For Android development, CI helps maintain code quality, catch regressions early, enforce consistent builds, and support automated deployment pipelines. Bamboo is a CI/CD server from Atlassian that can orchestrate automated builds, testing, and deployments for Android applications.

This document explains how to set up Bamboo for Android projects, configure build plans, run tests, and integrate deployment actions.

What Is Bamboo?

Bamboo is a CI/CD server that integrates with popular version control systems such as Git, Bitbucket, and GitHub. It supports pipelines called Build Plans which consist of Stages, Jobs, and Tasks. Android projects can benefit from Bamboo’s ability to:

  • Run automated builds using Gradle
  • Execute unit and instrumentation tests
  • Archive build artifacts (APKs, test reports)
  • Trigger builds automatically on code commits
  • Integrate with issue trackers and deployment tools

Bamboo’s UI and REST APIs allow flexible configuration, build visualization, and integration with other tools in the development ecosystem.

Why Use CI for Android Projects

Automated integration helps address several challenges in mobile development:

  • Inconsistent local environments – Ensures builds behave identically across machines
  • Regression detection – Early identification of failures prevents late surprises
  • Automated testing – Encourages writing and executing unit and UI tests regularly
  • Artifact management – Builds and test outputs are stored for traceability
  • Deployment automation – Produces signed APKs ready for release or beta distribution

Prerequisites

Before configuring Bamboo for Android builds, ensure:

  • A Bamboo server is available and accessible
  • Source code is stored in a VCS (Git, Bitbucket, GitHub)
  • The Android SDK and build tools are installed on the Bamboo build agents
  • The project uses Gradle (standard build system for Android)
  • Necessary environment variables such as ANDROID_HOME or ANDROID_SDK_ROOT are configured

Setting Up Bamboo for Android

1. Install and Configure Agents

Android build dependencies must be available on the Bamboo build agent machines:

  • Java Development Kit (JDK) – Required for Gradle builds
  • Android SDK & Platform Tools – Ensure availability of build tools for targeted API levels
  • Gradle Wrapper – Included in the project for reproducible builds

Install and configure the Android SDK in the agent environment. Set environment variables before running builds:

export ANDROID_SDK_ROOT="/path/to/android/sdk"
export PATH="$ANDROID_SDK_ROOT/platform-tools:$PATH"

The build agent will use these variables when executing build tasks.

2. Create a Plan in Bamboo

A Bamboo Plan defines how the Android project will be built.

  1. Go to Dashboard → Create → Create Plan
  2. Set Plan Name and Project
  3. Link to the Version Control Repository (Git / Bitbucket / GitHub)
  4. Configure the Source Repository details and authentication

Once the plan is created, you will define the build steps that execute your Android build.

3. Add Job Tasks for Android Build

Each build plan contains one or more Jobs. A job consists of one or more Tasks.

Key Tasks for Android

Checkout Repository

Automatically fetches source code from the repository.

Gradle Build Task

Use the Gradle Wrapper to execute build tasks such as:

./gradlew clean assembleDebug

This task compiles the app and generates an APK.

Unit Tests

Execute unit tests using:

./gradlew test

Instrumentation Tests

For instrumentation (UI) tests, use:

./gradlew connectedAndroidTest

These tasks execute connected tests on emulators or cloud device farms (if integrated).

4. Archiving and Reporting

Once the build and tests complete successfully, Bamboo can archive build artifacts and publish test reports.

Archiving Build Artifacts

Configure artifact definitions under the plan:

  • Path to generated APKs (app/build/outputs/apk/*.apk)
  • Test reports (app/build/reports/tests/testDebugUnitTest/)

These artifacts are stored in Bamboo for download, deployment, or further pipelines.

Test Reports

Bamboo can parse JUnit XML reports and display pass/fail results as part of the build summary. Ensure your Gradle configuration outputs test reports in JUnit format.

5. Automating Build Triggers

Continuous Integration is most effective when builds are triggered automatically upon code changes.

Configure triggers such as:

  • Repository triggers — Build runs when changes are pushed to the repository
  • Schedule triggers — Periodic builds at defined intervals (e.g., nightly)

Automatic triggers ensure teams receive immediate feedback on broken builds.

6. Deployment Workflow Integration

Bamboo supports integrating deployment processes, such as:

  • Uploading signed APKs to distribution platforms (TestFlight, Firebase App Distribution)
  • Notifying Slack / email channels on build status
  • Deploying to staging environments

Deployment automation improves release reliability and reduces manual errors.

Android CI Using Gradle and Bamboo Best Practices

Use Gradle Wrapper

Include the Gradle Wrapper (gradlew) in your repository to ensure consistent builds across systems.

Isolate Build Environment

Use clean work directories to avoid cross-run contamination and improve reproducibility.

Keep Dependencies Up to Date

Regularly update Android SDK build tools, Gradle plugin, and libraries to avoid compatibility issues.

Parallelize Test Execution

Split test tasks across agents if possible to reduce build times.

Choosing Between Bamboo and Other CI Tools

While Bamboo provides strong integration with Atlassian ecosystems (JIRA, Bitbucket), alternative CI providers (GitHub Actions, GitLab CI, Jenkins) may offer different workflows or cloud-native execution. Choose a CI platform based on:

  • Toolchain compatibility
  • Team structure
  • Cloud vs self-hosted preferences
Visited 4 times, 2 visit(s) today
Close