Ubuntu/Android/SDK/AVD
From r00tedvw.com wiki
Contents |
Overview
Done on Ubuntu 20.04 LTS.
Installed without Android Studio
Download Prerequisites
Get the commandline tools.
https://developer.android.com/studio > Download options > commandlinetools-linux-7583922_latest.zip
~$ wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
Make the directory Android SDK/AVD will live in.
~$ sudo mkdir /opt/android
Unzip
~$ sudo unzip ~/commandlinetools-linux-7583922_latest.zip -d /opt/android
Move sdkmanager
~$ sudo mkdir /opt/android/cmdline-tools/latest ~$ sudo mv /opt/android/cmdline-tools/bin/sdkmanager /opt/android/cmdline-tools/latest
Set Env Vars and Path
I had to do this in a few places. root, user, and sudoers.
root & user
Create a bash_alias for root, modify .profile for user. Same data in both.
~$ sudo touch /root/.bash_aliases ~$ sudo vim /root/.bash_aliases ~$ sudo vim ~/.profile # set PATH so it includes android sdk emulator if it exists if [ -d "/opt/android/emulator" ] ; then PATH="/opt/android/emulator:$PATH" fi # set PATH so it includes android sdk platform tools if it exists if [ -d "/opt/android/platform-tools" ] ; then PATH="/opt/android/platform-tools:$PATH" fi # set PATH so it includes android sdk command line tools if it exists if [ -d "/opt/android/cmdline-tools" ] ; then PATH="/opt/android/cmdline-tools:$PATH" fi # set PATH so it includes android sdk command line tools bin if it exists if [ -d "/opt/android/cmdline-tools/bin" ] ; then PATH="/opt/android/cmdline-tools/bin:$PATH" ANDROID_SDK_ROOT="/opt/android" ANDROID_HOME="/opt/android" fi # set PATH so it includes android sdk command line tools if it exists if [ -d "/opt/android/cmdline-tools/latest" ] ; then PATH="/opt/android/cmdline-tools/latest:$PATH" fi
sudoers
use sudo visudo
then add the following to the Defaults secure_path=
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/opt/android/cmdline-tools/bin:/opt/android/cmdline-tools/latest:/opt/android/emulator:/opt/android/platform-tools"