Skip to content

Android

Development

Android development requires a JDK and ant to be installed.

Terminal window
sudo apt-get install ant openjdk-11-jdk

Set $JAVA_HOME by adding the following line to your .bashrc and run source ~/.bashrc:

Terminal window
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

Setting up Gradle

For building Android apps, Gradle needs to be installed. The version bundled with Ubuntu is pretty old, so a PPA is advised.

Terminal window
sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt upgrade gradle

Setting up the SDK

Specify a location to store the Android SDK by adding the following lines in your .bashrc.

Terminal window
export ANDROID_HOME=$HOME/.local/share/android-sdk
export PATH=$ANDROID_HOME/emulator:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH

Then run source ~/.bashrc.

Go to the Android Studio site and follow the download instructions for the Get just the command line tools. Extract the SDK zip.

Terminal window
unzip -d "$ANDROID_HOME" /path/to/commandlinetools-*.zip

Now use sdkmanager to install at least the following tools:

Terminal window
sdkmanager \
'build-tools;25.0.3' \
'emulator' \
'extras;android;m2repository' \
'extras;google;google_play_services' \
'extras;google;m2repository' \
'platform-tools' \
'platforms;android-25' \
'system-images;android-25;google_apis;x86'

When running on a 64 bit machine, the Android SDK and emulator also need some 32 bit libraries:

Terminal window
sudo apt-get install lib32z1 lib32stdc++6