Android
Development
Android development requires a JDK and ant
to be installed.
sudo apt-get install ant openjdk-11-jdk
Set $JAVA_HOME
by adding the following line to your
.bashrc
and run
source ~/.bashrc
:
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.
sudo add-apt-repository ppa:cwchien/gradlesudo apt-get updatesudo apt upgrade gradle
Setting up the SDK
Specify a location to store the Android SDK by adding the following
lines in your .bashrc
.
export ANDROID_HOME=$HOME/.local/share/android-sdkexport PATH=$ANDROID_HOME/emulator:$PATHexport PATH=$ANDROID_HOME/platform-tools:$PATHexport 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.
unzip -d "$ANDROID_HOME" /path/to/commandlinetools-*.zip
Now use sdkmanager
to install at
least the following tools:
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:
sudo apt-get install lib32z1 lib32stdc++6