Build Android Studio development environment in Linux

First,download&install JDK and configure environment variable.

  • Enter the official website to download JDK8 or JDK9(Must hook on Accept License Agreement option to start download)

    choose a JDK suit for the version of your Linux system

  • After downloaded,cut or copy the JDK file to whatever directory you like.

    you can do so by file manager or terminal.
    move
    mv <目标文件> <目标路径>
    extract
    tar -xvf file.tar //extract tar package
    tar -xzvf file.tar.gz //extract tar.gz
    tar -xjvf file.tar.bz2 //extract tar.bz2
    tar -xZvf file.tar.Z //extract tar.Z
    unrar e file.rar //extract rar
    unzip file.zip //extract zip

  • Configure environment variable

    sudo vim /etc/profile

    append the following codes in the last of the file
    export JAVA_HOME=/home/cwj/jdk1.8.0_144 //be careful, this path should be the same as the location of your JDK. export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:$PATH
    >Make the change work in this terminal
    source /etc/profile

  • Check whether it is work or not
    java -version

If your terminal has the same output as the picture, it means that it is work properly.



二、Install Android Studio

  • Download Android Studio from the official website. Choose Linux version
    • When finished downloading,move the package to a directory and extract it.
    • Enter./android-studio/bin directory,double click studio.sh to start.
    • And then, you can use Android Studio to build your Android application.

一、下载安装JDK并配置环境变量

  • 进入官网下载JDK。(要 勾选 Accept License Agreement 才能下载哦)

    选择Linux版本的JDK

  • 我自己选择的是Linux ×64 176.92MB那个。

  • 下载完成后,将文件拷贝或剪切到你自己喜欢的文件夹中解压

    可以用文件管理器(和Windows的操作一样)也可以用终端命令操作。
    移动
    mv <目标文件> <目标路径>
    解压
    tar -xvf file.tar //解压 tar包
    tar -xzvf file.tar.gz //解压tar.gz
    tar -xjvf file.tar.bz2 //解压 tar.bz2
    tar -xZvf file.tar.Z //解压tar.Z
    unrar e file.rar //解压rar
    unzip file.zip //解压zip

  • 配置环境变量
    sudo vim /etc/profile

vim 在normal模式下按 i 就可以输入,输入完成后 按Esc键进入normal模式再按:键,输入wq(保存退出),再回车即可。如果实在不会用vim 可以选择使用gedit sudo gedit /etc/profile(输入完记得要保存)。

  • 打开文件后在末尾输入
export JAVA_HOME=/home/cwj/jdk1.8.0_144  //注意该路径需要改为你的JDK所在路径
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:$PATH
_SILENT_JAVA_OPTIONS="$_JAVA_OPTIONS"
unset _JAVA_OPTIONS
alias java='java "$_SILENT_JAVA_OPTIONS"'

  • 使改变在本终端生效
    source /etc/profile

  • 配置好以后,查看是否成功
    java -version

  • 如果结果如下图,表示JDK安装成功


二、安装Android Studio

  • 在中文社区(官网)下载 Linux版Android Studio
    • 下载完成后,移动到你的应用存放目录,解压
    • 进入./android-studio/bin目录,双击打开studio.sh
    • 然后就可以开始配置Android Studio啦
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容