I have an Android project currently building an APK in github actions:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Build Application
run: |
./gradlew clean assembleDebug
Translated to this in GitLab:
stages:
- build
build:
image: openjdk:11
stage: build
when: manual
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
In GitHub build I am getting an error:
SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable
What I don't understand is that I cannot find anything in my GitHub build where it downloads the Android SDK. Why is this build working in GitHub but not GitLab?
CodePudding user response:
Android SDK is included in the preinstalled software on GitHub-hosted Actions runner. That's why you don't have to install it in the case when you are using GitHub.
In GitLab, you are using the openjdk:11
image for your job. The Android SDK is not installed in the openjdk:11
image. To deal with this, you could change the image:
parameter in your job to use an image with the SDK already installed or install the SDK as part of your job.