近期需要使用Android Studio做开发,第一步就是在ubuntu下的安装
网上找了一个亲测靠谱的,记录一下。
原文链接:https://linuxhint.com/install_android_studio_ubuntu1804/
Method 3 (The Zip File)
This is one trusted method of installing Android Studio. However, it may take some time as well as patience typing in the commands.
First: We would have to install the Java Development Kit from Oracle.
Installing the Java Development Kit requires some prerequisites which can be installed with the commands below:
sudo apt update
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 wget
Now we can proceed with installing the JDK with the command below:
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
This would take a while, however you should stay close by. An Oracle License agreement prompt would come up asking you to confirm an agreement to their terms.
The prompt is usually about four lines long, with an option for you to choose “Yes” or “No”. Choose “Yes” and then proceed.
After a successful installation, you can check Java version with:
java -version
Also you can check the Java compiler’s version with:
javac -version
Next, we change directories to the Downloads directory and download the Android Studio zip filethere. This can be done with the commands below:
cd Downloads/
wget https://dl.google.com/dl/android/studio/ide-zips/3.1.3.0/android-studio
-ide-173.4819257-linux.zip
Just like our previous downloads, this could take some time. After downloading, unzip the file into the /opt directory where our software files stay with the following command:
sudo unzip android-studio-ide-*-linux.zip -d /opt/
You should now have your android-studio directory unzipped in the /opt directory.
To run android studio, go to the bin directory in the unzipped android studio directory and run the
studio.sh file:
cd /opt/android-studio/bin
studio.sh
It should run fine, however close the launched application—do not proceed with the setup just yet. You can symlink the studio.sh file to the /bin directory, so you can simply run android studio from any directory on the commandline.
You can do that with the command below:
sudo ln -sf /opt/android-studio/bin/studio.sh /bin/android-studio
However you won’t be able to access Android Studio from your list of applications just yet, we would cover this in the final setup.
Final setup
After finishing installations, launch Android Studio again—if you used method three, type android-studio in the terminal—and proceed with the Android Studio Setup Wizard.
Running the setup wizard would take some time as the application is expected to make some other downloads.
After completion of all possible downloads, you should download the necessary SDK to develop software for your target android versions. It is expected that this comes up by default, but if it doesn’t you can download it through the following steps:
Click on “File”, then “Settings”, then “Android SDK”. You would see the Android SDKs for the different versions of android you plan to build for, then choose the ones you wish to download.
For those who installed using the third method, you can add the desktop icon to your app tray now. By clicking “Tools” and then “Create Desktop Entry.”
There you have it, Android Studio installed on your Ubuntu 18.04.
亲测有效,就是下载Android Ide时候,需要到中文社区中下载,原文给的地址无法下载。
另外下载的安装包,并不包含SDK但是在安装时会自动下载
有个现象就是,昨天安装时总是无法正确安装sdk,今天却十分顺利,原因不明,可能是网络的事