Skip to content
Snippets Groups Projects
Commit 2dd2c7f9 authored by Sydney Anne Erickson's avatar Sydney Anne Erickson :chipmunk:
Browse files

Android migration guide

parent 860339a7
No related branches found
No related tags found
No related merge requests found
Pipeline #6864 passed
......@@ -12,7 +12,7 @@ The following software is installed onto the Android CI VM for builds:
- GoLang (version 1.17.5)
- Java OpenJDK 8
- Android SDK Tools (version 3859397)
- Android SDK Tools (version 7583922)
- Android platform SDK (version 25)
- Android platform SDK (version 29)
- Android platform SDK (version 30)
......@@ -30,11 +30,15 @@ Additionally, the following tools are explicitly installed:
Software not on the above lists may be available, but cannot be relied upon if Ubuntu removes them from the base install in a future update.
## Migrating to the new SDK version
Renaming the `$ANDROID_HOME` environment variable to be `$ANDROID_SDK_ROOT` is required for tools to find the SDK. `$ANDROID_HOME` is deprecated ([see here for more details](https://developer.android.com/studio/command-line/variables)).
## Using the Android CI
You need to tag the builds that need the Android tooling in your `.gitlab-ci.yml` file with the `android` tag. (If you're unfamiliar with what a `.gitlab-ci.yml` file is, [GitLab describes it here.](https://docs.gitlab.com/ee/ci/yaml/gitlab_ci_yaml.html)) An example is below. This should only be done for jobs where the Android SDK tools are directly required, as job capacity is very limited.
When using the `android` tag, you need to ensure that `/android-sdk/platform-tools/` is in your `$PATH` environment variable, as well as setting the `$ANDROID_HOME` environment variable to `/android-sdk`. Both of these can be done in a `before_script` if you have multiple jobs that use the `android` tag, or done in the `script` part of your job for just one.
When using the `android` tag, you need to ensure that `/android-sdk/platform-tools/` is in your `$PATH` environment variable, as well as setting the `$ANDROID_SDK_ROOT` environment variable to `/android-sdk`. Both of these can be done in a `before_script` if you have multiple jobs that use the `android` tag, or done in the `script` part of your job for just one.
You may optionally want to add `/usr/local/go/bin` to your `$PATH` if you plan to build Go programs for Android in your job, such as building client bindings.
......@@ -43,7 +47,7 @@ stages:
- build
before_script:
- export ANDROID_HOME=/android-sdk
- export ANDROID_SDK_ROOT=/android-sdk
- export PATH=/android-sdk/platform-tools/:$PATH
app-build:
......@@ -74,32 +78,30 @@ set -e
# --- System ---
# Firewall
sudo apt-get install -y ufw
sudo apt-get install -y ufw fail2ban
sudo ufw allow ssh
sudo ufw enable
# Fail2Ban
sudo apt-get install -y fail2ban
# --- Java ---
sudo apt-get install -y openjdk-8-jdk-headless
# --- Android SDK ---
sudo apt-get install -y wget tar unzip lib32stdc++6 lib32z1
wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
unzip -d android-sdk-linux android-sdk.zip
echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-29"
echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-30"
echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools"
echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;29.0.2"
yes | android-sdk-linux/tools/bin/sdkmanager --licenses --no_https
yes | android-sdk-linux/tools/bin/sdkmanager --no_https "emulator" "platform-tools" "platforms;android-25" "system-images;android-25;google_apis;x86"
sudo mkdir /android-sdk
wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
sudo unzip -d /android-sdk android-sdk.zip
sudo mv /android-sdk/cmdline-tools/ /android-sdk/tools
sudo mkdir /android-sdk/cmdline-tools
sudo mv /android-sdk/tools /android-sdk/cmdline-tools/tools
yes | sudo /android-sdk/cmdline-tools/tools/bin/sdkmanager --licenses --no_https
yes | sudo /android-sdk/cmdline-tools/tools/bin/sdkmanager --no_https "emulator" "platform-tools" "platforms;android-25" "platforms;android-29" "platforms;android-30" "build-tools;29.0.2" "system-images;android-25;google_apis;x86"
rm -rf android-sdk.zip
sudo mv android-sdk-linux /android-sdk
# --- Go ---
sudo apt-get install -y wget
wget https://go.dev/dl/go1.17.5.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz
rm -rf go*
# --- GitLab Runner ---
# GitLab Runner
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment