我電腦的環境是Ubuntu 12.04 64位。php
Android Studio下載地址:https://developer.android.com/sdk/installing/studio.html#downloadhtml
看下各個環境的說明
java
/**************************************/
最簡單的方式:雙擊直接解壓而後mv到opt文件夾下,直接點擊
bin目錄下的studio.sh打開。
/**************************************/linux
下面開始安裝
Ctrl+Alt+T打開terminal,進行解壓:android
1 2 |
tar xzvf ~/Downloads/android-studio-bundle-130.677228-linux.tgz
sudo mv android-studio /opt/
|
而後開始安裝:ubuntu
1 2 |
cd android-studio/bin/
./studio.sh
|
可能會跑出來這句話:android-studio
1 2 3 4 5 6 7 8 9 10 11 12 13 |
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
WARNING: You are launching the IDE using OpenJDK Java runtime.
ITS KNOWN TO HAVE PERFORMANCE AND GRAPHICS ISSUES!
SWITCH TO THE ORACLE(SUN) JDK BEFORE REPORTING PROBLEMS!
NOTE: If you have both Oracle (Sun) JDK and OpenJDK installed
please validate either STUDIO_JDK, JDK_HOME, or JAVA_HOME environment variable points to valid Oracle (Sun) JDK installation.
See http://ow.ly/6TuKQ for more info on switching default JDK.
Press Enter to continue.
|
我電腦上裝得是Ubuntu自帶的OpenJDK,可能會出現一些錯誤或者警告什麼的,因而我從新裝了一遍JDK。bash
到http://www.oracle.com/technetwork/java/javase/downloads/index.html
下載JDK,我下的是最新版的jdk-7u21-linux-x64.tar.gz(64位),建議下載1.6版本的,最新的不怎麼穩定。網上有不少安裝的方法(好比,
http://forum.ubuntu.org.cn/viewtopic.php?t=183803,
http://blog.csdn.net/yang_hui1986527/article/details/6677450,
http://www.cnblogs.com/shaoguobao/archive/2011/07/16/2108015.html )oracle
而後解壓、配置環境變量:jvm
1 2 3 4 5 6 7 8 9 10 11 12 |
tar xzvf ~/Downloads/jdk-7u21-linux-x64.tar.gz
sudo mv jdk1.7.0_21/ /usr/lib/jvm/
sudo vi /etc/environment
PATH="......:/usr/lib/jvm/jdk1.7.0_21:/opt/android-studio/bin/"
CLASSPATH=.:/usr/lib/jvm/jdk1.7.0_21
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21
source ~/.bashrc
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_21/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_21/bin/javac 300
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_21/bin/javaws 300
sudo update-alternatives --config java
sudo update-alternatives --config javaws
|
用java -version測試下安裝是否成功:
1 2 3 4 |
java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
|
若是你裝的是64位的Ubuntu還要繼續輸入:
1 |
apt-get install lib32ncurses5 ia32-libs
|
最後再從新試一遍:
1 |
studio.sh
|
OK,成功!
熟悉下流程:
聲明:eoe文章著做權屬於做者,受法律保護,轉載時請務必以超連接形式附帶以下信息
原文做者: gaolei_xj