大晚上的睡不着,最近老失眠,索性玩玩Android Studio。
我电脑的环境是Ubuntu 12.04 64位。
Android Studio下载地址:https://developer.android.com/sdk/installing/studio.html#download
看下各个环境的说明
![360截图20130517040715932.jpg 360截图20130517040715932.jpg](http://a1.eoe.cn/www/home/201305/17/faa7/51953cb8a359c.jpg)
下面开始安装
Ctrl+Alt+T打开terminal,进行解压:
|
tar xzvf ~/Downloads/android-studio-bundle-130.677228-linux.tgz
sudo mv android-studio /opt/
|
然后开始安装:
|
cd android-studio/bin/
./studio.sh
|
可能会跑出来这句话:
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。
到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 )
然后解压、配置环境变量:
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测试下安装是否成功:
|
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还要继续输入:
|
apt-get install lib32ncurses5 ia32-libs
|
最后再重新试一遍:
![Android_Studio.jpg Android_Studio.jpg](http://a1.eoe.cn/www/home/201305/17/f39c/519539ed4875d.jpg)
![Android_Studio_Gradle_Download.jpg Android_Studio_Gradle_Download.jpg](http://a1.eoe.cn/www/home/201305/17/bf6b/519539ee96921.jpg)
![Android_Studio_New_Project.jpg Android_Studio_New_Project.jpg](http://a1.eoe.cn/www/home/201305/17/1bbd/51953bf6af11a.jpg)
![Android_Studio_Project_Java.jpg Android_Studio_Project_Java.jpg](http://a1.eoe.cn/www/home/201305/17/e92e/51953a0571761.jpg)
OK,成功!
熟悉下流程:
![360截图20130517040948819.jpg 360截图20130517040948819.jpg](http://a1.eoe.cn/www/home/201305/17/5b71/51953d59deeb9.jpg)
我去睡觉了,写的可能不是特别清楚,有问题就在下面问吧。