Skip to content

Linux Build Agent Setup

Marc Durdin edited this page Jun 10, 2021 · 4 revisions

Common

Android

  1. Install dependencies
cd ~
sudo apt install openjdk-8-jdk
wget https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
unzip commandlinetools-linux-6609375_latest.zip -d cmdline-tools
sudo mkdir /user/lib/android-sdk
sudo mv cmdline-tools /usr/lib/android-sdk
sudo chown -R [login:group] /usr/lib/android-sdk
sudo dpkg -i pandoc-2.13-1-amd64.deb
  1. Since there's likely multiple Java versions installed, choose Java 8
sudo update-alternatives --config java
  1. Update Android SDK and Accept Android SDK licenses
cd /usr/lib/android-sdk/cmdline-tools/tools/bin
sdkmanager "platform-tools" "platforms;android-30"
sudo ./sdkmanager --update
cd ../../../build-tools/licenses
yes | sdkmanager --licenses
  1. Add the following to bottom of ~/.bashrc
# Export the Android SDK path
export ANDROID_HOME="/usr/lib/android-sdk"
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/tools/bin
  1. Edit /var/lib/TeamCity/agent/conf/buildAgent.properties and set the following for TeamCity environment vars
env.PATH=/usr/local/bin:/usr/bin:/bin:/usr/lib/android-sdk/cmdline-tools/tools/bin:~/.cargo/bin
env.DISPLAY=:0
env.ANDROID_HOME=/usr/lib/android-sdk
env.JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
  1. Restart the TeamCity agent to pick up the new environment variables
cd /var/lib/TeamCity/agent/bin
./agent.sh stop
./agent.sh start

TODO

Clone this wiki locally