Installing Android on Ubuntu 20.10

This post is an addendum to installing Ubuntu, if you are missing any packages, please see the Essentials section in that post. Let’s get cracking!

Install Java

Not absolutely necessary, but I prefer to use the default JDK:

sudo apt install default-jdk default-jre

Setup Virtualization

The Android Emulator runs faster when virtualization software is used. Before proceeding, please make sure virtualization is enabled in your BIOS. Let’s verify if your CPU is supported:

sudo apt install cpu-checker

egrep -c '(vmx|svm)' /proc/cpuinfo

if the result is 0 then virtualization is not supported, skip to the next section.

sudo kvm-ok

The output should indicate that KVM acceleration can be used, if not skip to the next section.

Let’s configure virtualization as per this recommendation.

sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon libvirt-daemon-system virtinst bridge-utils 

sudo systemctl enable --now libvirtd

sudo systemctl status libvirtd

Add the current user to the KVM group:

sudo adduser $USER kvm

sudo reboot

Install Android Studio

Download the tar file from here.

I have a folder called Apps where I install software. I’ll change into that folder to begin the install:

cd ~\Apps

tar -xzf ~/Downloads/android-studio-ide-201.6953283-linux.tar.gz 

cd android-studio/bin

./studio.sh

Follow the prompts to complete your install. I typically select to use the version of the JDK we installed earlier, found at this location:

/usr/lib/jvm/java-11-openjdk-amd64

Post Installation Configuration

I like to use Sdk 28 for Flutter, so I install that from the SDK Manager available form the configuration drop down menu.

I also install the Command Line Tools.

Remember to create a desktop shortcut from the configuration menu’s Create Desktop Entry item.

Environment Configuration

Lastly, a few tweaks to the environment so everything runs smoothly.

sudo vim ~/.bashrc

Add this to the end of your bashrc file:

export ANDROID_SDK_ROOT=$HOME/Android/Sdk

export PATH=”$PATH:$ANDROID_SDK_ROOT/emulator:
$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools”

Now you can create an device using AVD, perhaps called nexus, and start it from the console:

emulator @nexus &

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s