in Android

Install Android Studio 2 on Apricity Linux

I want to reinstall android studio on my apricity linux box and as always I need to write the process for my future reference.

Android Studio 2

I use yaourt :

yaourt -S android-studio

note : same command also work for upgrade Android Studio to newer version

Java in Apricity

By default android studio will install openjdk 7 so I ended with 3 version of Java after install Oracle JDK :

yaourt -S jdk

ls /usr/lib/jvm

default  default-runtime  java-7-openjdk  java-8-jdk  java-8-openjdk

Make Oracle JDK for Android Studio as it always give me warning :

openjdk

“System Health
OpenJDK shows intermittent performance and UI issues. We recommend using the Oracle JRE/JDK.”

Set environment :

sudo nano /etc/environment

and this line :

JAVA_HOME=/usr/lib/jvm/java-8-jdk

save. For more detail explanation of switching you can refer to this.

Update :

Java Compiler aka javac

I just realized that javac command return an error :

javac -version

zsh: command not found: javac

Woot 🙂

ls -al /usr/bin | grep javac

lrwxrwxrwx 1 root root 30 Nov 2 2014 javac -> /usr/lib/jvm/default/bin/javac

quick resolv :

sudo rm /usr/bin/javac

sudo ln -s /usr/lib/jvm/java-8-jdk/bin/javac /usr/bin/javac

Testing javac version

javac -version

javac 1.8.0_102

Fix Java Version error message

For this error message :

Error:Buildtools 24.0.1 requires Java 1.8 or above.  Current JDK version is 1.7.

Open File -> Project Structure -> Locate for JDK 8 and hit OK button

rasyid_net_fix_android_jdk_version

Tuning Android Studio Memory Usage

I have 8 GB memory but still need to optimize performance of Android Studio

Click Help -> Edit Custom VM options, click Yes.

options_vm_android_studio

I change my minimum and maximum memory into these numbers :

-Xms756m
-Xmx4096m