visit
I remember spending hours of research trying to find a config.yml file that would work easily for Gitlab specifically.
# Begin by defining the image to be used, this is what I found as the latest version to work well for Android in 2019/2020
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.2"
ANDROID_SDK_TOOLS: "4333796"
# PLEASE EDIT THIS PART TO MATCH YOUR PROJECT FOLDER NAME
before_script:
- cd <<INSERT THE NAME OF YOUR PROJECT FOLDER>>;
- chmod +x ./gradlew
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 ruby-full build-essential g++
- wget --quiet --output-document=android-sdk.zip //dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
# This is important to temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
# This step installs Fastlane
- gem install bundler
- bundle install
# This step specifies the stages to be executed when the script is running. For this example, I used only one stage.
# You can have more than one stage listed here.
stages:
- build
# This step defines where the release apk is uploaded to on Google Play Store.
# In this example, it's uploaded to the Beta track/phase when the pipeline in my master branch (on Gitlab) runs successfully.
assembleRelease:
stage: build
only:
- master
script:
- ./gradlew assembleRelease
- bundle exec fastlane beta
artifacts:
paths:
- app/build/outputs/
Main Reference:
Also published at