This site uses cookies to analyse traffic, remember your preferences, and optimise your experience. Learn more, read the privacy policy page.


How to speed up Android Gradle build in continuous integration

How to speed up Android Gradle build in continuous integration

Below is a sample task for Concourse CI, which caches gradle packages for future builds.

build_android.sh

---
platform: linux

image_resource:
  type: docker-image
  source:
    repository: alvrme/alpine-android
    tag: android-28

inputs:
  - name: app-repo

run:
  path: app-repo/ci/tasks/build_android.sh

caches:
  - path: .gradle

build.sh

#!/bin/sh

set -eux

export ROOT_FOLDER=$(pwd)
export GRADLE_USER_HOME="${ROOT_FOLDER}/.gradle"

cd app-repo

./gradlew assembleDebug

At the beginning of shell script I set the path GRADE_USER_HOME to be relative to the currently used workspace, so that Concourse can save the files for later.

Word count: 92

Want to know more and be immediately informed about new posts?

Let's stay in touch and leave your email:

Related posts: