Recently, I tried to replace the Eclipse Android Development Environment in my computers with the Android Studio Developed by Google. But, unfortunately ended up getting so many errors on Linux Ubuntu.
After some digging on the internet and many failed attempts to change permissions in directories of the Operating System, I finally managed to get things working and thought that I could write this down in the Notes, So, that in the
future there won't be any inconveniences.
First I downloaded Android Studio from the official developer Web Site here.
After downloading the .zip file. I extracted the whole thing By Just Right Click-> Extract Here.
Inside the Extracted android-studio/bin Directory there's 'studio.sh' which is the 'Self Extracting Archive' is the file to be executed, to do that I just launched my terminal. (Ctrl + T)
$ cd Downloads/android-studio/bin
$ ./studio.h
It took a quite a bit of time and ended up, showing an error for the versions. That was completely annoying and it kept coming.
So, initially, what I thought was that It could be a problem with the Java versions and I tried to understand which version of it that had at the moment.
$ java -version $ dpkg --list | grep -i jdk
It showed me that I had OpenJDK 6. So, I decided to Update the Java Version.
$ sudo apt-get update
[ To Download the package lists from repositories. ]
$ sudo add-apt-repository ppa:webupd8team/java
[ Add the Repositories if it doesn't exist ]
$ sudo apt-get update && sudo apt-get install oracle-jdk7-installer
$ update-alternatives --display java
At the end of this line, I had to opt the Required version and I typed #3 which was the required OpenJDK1.7.0. And I tried running the './studio.h' again and guess what I ended with the, Error message saying "tools.jar is not in android studio class path Please ensure JAVA_HOME points to JDK rather than JRE".
As usual when it comes to settings related to default paths, what comes to our mind usually is, '.bashrc'. So I ran the following commands.
$ cd ~ $ vi .bashrc
I added the following lines at the end of the '.bashrc' having typed the comments for future references. Comments are shown after '#' in shell scripting.
# comment : the .bashrc is eddited to add java_home by Harsha JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386" export JAVA_HOME PATH=$PATH:$JAVA_HOME
I Saved the file, and ran,
$ source ~/.bashrc $ echo $JAVA_HOME
Above is to test that it echoes the Java path. Then , I tried run the '/studio.h'. Still I kept getting the Error "tools.jar is not in
android studio class path Please ensure JAVA_HOME points to JDK rather than JRE".
After digging the Internet for around 10 minutes, I found out the way of doing this. So, Here's the whole thing. Exporting the JDK path in the '~/.bashrc' won't give us the right answer. So do the following.
$ sudo apt-get install openjdk-7-jdk [ If you don't have it ] $ sudo vi /etc/environment
Add the line.
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
Save & Close. You probably would require a reboot of the System. After the Reboot is made, run the '/.studio.h' and
you'd love using Android Studio which is a better application by the way.
Thank You.
No comments:
Post a Comment