在CentOS 7和Ubuntu14.04上安装Android Studio

前端之家收集整理的这篇文章主要介绍了在CentOS 7和Ubuntu14.04上安装Android Studio前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

先介绍在CentOS 7的安装过程,再介绍Ubuntu14.04上的安装过程:

1、卸载OpenJDK,下载JDK最新版本,然后安装:

rpm -qa | grep java
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el7_3.x86_64
rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.131-2.6.9.0.el7_3.x86_64
rpm -e --nodeps javapackages-tools-3.4.1-11.el7.noarch
rpm -e --nodeps tzdata-java-2016h-1.el7.noarch
rpm -e --nodeps tzdata-java-2016j-1.el7.noarch
rpm -e --nodeps python-javapackages-3.4.1-11.el7.noarch
mkdir /usr/java
mv jdk-8u121-linux-x64.tar.gz /usr/java/
cd /usr/java
tar -zxvf jdk-8u121-linux-x64.tar.gz
vi /etc/profile

文件最后加上

#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_121
JRE_HOME=/usr/java/jdk1.8.0_121/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

然后,更新环境变量:

source /etc/profile

2、下载安装Android Studio

下载地址:https://developer.android.goo...

如果是64位系统,需要预先安装一些软件包,然后将下载的android-studio安装到/opt/下:

yum install zlib-devel ncurses-devel libX11-devel libXrender libXrandrl  glibc   glibc-devel   libstdc++
yum install glibc.i686  glibc-devel.i686  libstdc++.i686  zlib-devel.i686  ncurses-devel.i686  libX11-devel.i686  libXrender.i686  libXrandr.i686

cd 下载
unzip android-studio-ide-145.3360264-linux.zip
mv android-studio/ /opt/
cd /opt
ln -s /opt/android-studio/bin/studio.sh /usr/local/bin/android-studio
android-studio

3、引用Google官方安装说明:
https://developer.android.goo...

required libraries for 64-bit machines:

If you are running a 64-bit version of Ubuntu,you need to install some 32-bit libraries with the following command:

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

If you are running 64-bit Fedora,the command is:

sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686

4、在Ubuntu上的安装过程比较简单,首先是试了发现不用安装jdk,然后见第3点的官方安装说明,在64位的Ubuntu上需要补充这些软件包。需要注意的是,如果给普通用户安装,最好下载解压到/home/用户名/,而不是/usr/local/或者/opt/,以方便普通用户访问。

cd 下载
cp android-studio-ide-162.3871768-linux.zip  ..
unzip android-studio-ide-162.3871768-linux.zip
cd android-studio
./bin/studio.sh

猜你在找的CentOS相关文章