Ubuntu 20: Install Android Studio

Homan Huang
5 min readJun 12, 2021

Android Studio supports JDK 8 or a newer version. Ubuntu has preinstalled OpenJava, which is a compact version. As a developer, you need to install JDK 8 from Oracle. After you swap the OpenJDK to Oracle JDK in Ubuntu, you can install Android Studio.

☕ 1. Java Installation …… → Menu

If you have installed Oracle JDK, you can skip this part.

Minimum Requirement — JDK Version 8:

You need Linux ARM 64 Compressed Archive.

Downloads

Create a folder — java at opt:

$ cd \opt
/opt$ mkdir java
/opt$ ls
google java

Uncompress to java:

/opt$ sudo tar -zxvf ~/Downloads/jdk-8u291-linux-x64.tar.gz -C /opt/java

Test version:

/opt/java$ ls
jdk1.8.0_291
/opt/java$ cd jdk1.8.0_291
/opt/java/jdk1.8.0_291$ cd bin
/opt/java/jdk1.8.0_291/bin$ java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

Update command in Linux:

/opt/java/jdk1.8.0_291/bin$ sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_291/bin/java 1
[sudo] password for YOU:
/opt/java/jdk1.8.0_291/bin$ cd
>
~$ java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

Good! Java is ready. 🤗

📱 2. Android Studio Installation …… → Menu

Android Studio:

https://developer.android.com/studio

Download the stable version:

Downloads

Extract here:

Ctrl+X → Home/Documents

Home/Documents/android-studio/bin: Open in Terminal

Change permission of studio.sh:

~/Documents/android-studio/bin$ ll *.sh
...
-rwxr-xr-x 1 homan homan 6336 May 10 10:56 studio.sh*
~/Documents/android-studio/bin$ sudo chmod 777 -R studio.sh
[sudo] password for YOU:
~/Documents/android-studio/bin$ ll *.sh
...
-rwxrwxrwx 1 homan homan 6336 May 10 10:56 studio.sh*
~/Documents/android-studio/bin$

Run Android Studio

~/Documents/android-studio/bin$ ./studio.sh

→ Welcome

→ Install Type

→ Select UI Theme

→ Verify Settings

→ Emulator Settings

→ Downloading Components

→ Android Studio

You’re ready.

🌙 3. Create a Shortcut …… → Menu

I move the android-studio from Documents to Home/IDE. Not tricky, it’s a simple Cut&Paste task.

Desktop → Open in Terminal:

I will use gedit program to add a new shortcut. You can install gedit by

 $ sudo apt install gedit

Add Desktop Shorcut

Open a folder → Other Locations

→ Computer

→ /usr/share/applications

→ Open in Terminal

→ add new desktop file:

/usr/share/applications$ sudo gedit 'Android Studio.desktop'

Save! You’re done. Let’s check.

🏄 4. VM Acceleration …… → Menu

This method requires a KVM package.

Terminal — Test Your Machine

Install cpu-checker:

~$ sudo apt-get install cpu-checker

Grap CPU Info:

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

This CPU has 24 cores.

~$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

Good, the KVM package is compatible to the machine.

Let’s install the KVM package.

~$ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager

Verify your work.

~$ sudo systemctl is-active libvirtd
active

Verify the connection:

~$ brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.5254006fab6d yes virbr0-nic

You need to add yourself to run and manage KVM:

~$ sudo usermod -aG libvirt $USER
~$ sudo usermod -aG kvm $USER

You’re READY!

The emulator is running smoother than Windows 10.

Happy Friday! ⛵Clap, clap!

--

--

Homan Huang

Computer Science BS from SFSU. I studied and worked on Android system since 2017. If you are interesting in my past works, please go to my LinkedIn.