Chi's Journal
- Ecclesiastes 1.11
Setup build environment for Android app in Ubuntu 18

Install sdk command-line tools

sudo apt install unzip # ensure unzip installed
sudo mkdir -p /usr/local/android-sdk/tools
cd /tmp
wget https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
unzip commandlinetools-linux-6200805_latest.zip
sudo mv tools/* /usr/local/android-sdk/tools/

# setup path, change ~/.bashrc to your shellrc
echo "export PATH=$PATH:/usr/local/android-sdk/tools/bin:/usr/local/android-sdk/platform-tools" >> ~/.bashrc
source ~/.bashrc

Install oracle-jdk8

Skip this section if jdk8 is already set.

Oracle JDK8 will be installed via ppa:kkeiichi/java, jdk-8u241-linux-x64.tar.gz should be downloaded and uploaded to the server before continuing.

Download link: Official Site DropboxBackup(package install script will check file shasum)

sudo mkdir -p /var/cache/oracle-java8-installer-local
sudo cp jdk-8u241-linux-x64.tar.gz /var/cache/oracle-java8-installer-local/

sudo add-apt-repository ppa:kkeiichi/java
sudo atp update
sudo apt install oracle-java8-installer-local
sudo apt install oracle-java8-set-default-local # set default

Install sdk

mkdir ~/.android
echo "export ANDROID_HOME=~/.android" >> ~/.bashrc
source ~/.bashrc

# accept linceses
yes | sdkmanager --sdk_root=$ANDROID_HOME --licenses
# download sdk
yes | sdkmanager --sdk_root=$ANDROID_HOME "platforms;android-28" "build-tools;28.0.3"

Last modified on 2020-05-17

Comments powered by Disqus