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 <目標(biāo)文件> <目標(biāo)路徑>
    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并配置環(huán)境變量

  • 進(jìn)入官網(wǎng)下載JDK。(要 勾選 Accept License Agreement 才能下載哦)

    選擇Linux版本的JDK

  • 我自己選擇的是Linux ×64 176.92MB那個(gè)。

  • 下載完成后,將文件拷貝或剪切到你自己喜歡的文件夾中解壓

    可以用文件管理器(和Windows的操作一樣)也可以用終端命令操作。
    移動(dòng)
    mv <目標(biāo)文件> <目標(biāo)路徑>
    解壓
    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

  • 配置環(huán)境變量
    sudo vim /etc/profile

vim 在normal模式下按 i 就可以輸入,輸入完成后 按Esc鍵進(jìn)入normal模式再按:鍵,輸入wq(保存退出),再回車即可。如果實(shí)在不會(huì)用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

  • 如果結(jié)果如下圖,表示JDK安裝成功


二、安裝Android Studio

  • 在中文社區(qū)(官網(wǎng))下載 Linux版Android Studio
    • 下載完成后,移動(dòng)到你的應(yīng)用存放目錄,解壓
    • 進(jìn)入./android-studio/bin目錄,雙擊打開studio.sh
    • 然后就可以開始配置Android Studio啦
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容