Public | Automated Build

Last pushed: 3 months ago
Short Description
GitLab CI image for building Android apps
Full Description

gitlab-ci-android

This Docker image contains the Android SDK and most common packages necessary for building Android apps in a CI tool like GitLab CI. Make sure your CI environment's caching works as expected, this greatly improves the build time, especially if you use multiple build jobs.

A .gitlab-ci.yml with caching of your project's dependencies would look like this:

image: jangrewe/gitlab-ci-android

stages:
- build

before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
  - .gradle/

build:
  stage: build
  script:
  - ./gradlew assembleDebug
  artifacts:
    paths:
    - app/build/outputs/apk/app-debug.apk
Docker Pull Command
Owner
jangrewe
Source Repository

Comments (2)
mlukman
8 months ago

Nevermind, I solved it by adding the following lines to before_script:

- if [ ! -d "/cache$ANDROID_HOME" ]; then mv $ANDROID_HOME /cache$ANDROID_HOME; fi
- export ANDROID_HOME=/cache$ANDROID_HOME
mlukman
8 months ago

Hi & thanks for this great image. Just wondering, is it possible to also cache the Android SDK installation path so that gradle does not have to re-install the SDKs for every build?