(i) Basic environment construction of Android small app development

Source: Internet
Author: User

First, the preparatory work:

1. Download the Android Studio development environment

Https://dl.google.com/dl/android/studio/ide-zips/2.1.1.0/android-studio-ide-143.2821654-linux.zip

2. Copy the downloaded file android-studio-ide-143.2821654-linux.zip to/usr

$sudo MV Android-studio-ide-143.2821654-linux.zip/usr

3. Compress the downloaded development environment package, unzip

$sudo Unzip Android-studio-ide-143.2821654-linux.zip

Note:

If you need to change the file owner and the owning user group, you can use the following command, the-r option is a recursive subfolder that also changes the owner and permissions:

 $sudo chown-r Xlz:xlz file_name

So under Linux There are/usr/android-studio/bin file forms of organization such as:

Second, start Android Studio

Enter the/usr/android-studio/bin directory, run $./studio.sh, and then the following error occurs:

‘tools.jar‘ seems to be not in Android Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE

When I try to $echo $JAVA _home , the output is empty, and the main cause of the problem is that there is no installation of OPENJDK-7-JDK, which can be $sudo apt-get install OPENJDK-7-JDK to resolve, however, after being tested, the installation OpenJDK starts Android Studio, it will appear, when using the boot tool to create a new project, the bottom line, there is next finish Previous button does not display properly, At the same time, Android Studio will also launch the interface will also report some warnings, such as the above buttons will not display the normal UI warning and some other problems, so for the sake of simplicity, here directly simple rough installation jdk-8.

Third, replace the Linux openjdk with the JDK (my system is debian8-x64)

1. Since the Linux system has been used for a period of time, so the original machine should be equipped with OPENJDK, in order to prevent some unknown problems that may be caused, it is necessary to first uninstall the original version of the OPENJDK.

$sudo Apt-get Purge openjdk-\*

2. To here, click I agree/accept to download the latest version of the JDK, here i download the jdk-1.8.0_ version

Attention:

Download the time do not download the wrong, please download the corresponding system version of the file, if your system is x64 Debian/ubuntu, then the download file name jdk-8u-linux-x64.tar.gz. (The red part indicates the version is good, your version may be different from my version)

3. Create the Java directory using the following command in the/usr/local directory

$sudo mkdir-p/usr/local/java

4. Copy the previously downloaded JDK files to the/user/local/java directory

$sudo Cp-r jdk-8u91-linux-x64.tar.gz/user/local/java/

5. Use the CD command to enter the/usr/local/java directory and unzip the JDK package using the following command

$sudo TAR-ZXVF jdk-8u91-linux-x64.tar.gz

6. After decompression, you can see that in the current directory (/usr/local/java/) there is a folder named jdk1.8.0_

7. Update the environment variable path. Using the $sudo vim/etc/profile command, open the/etc/profile file, and at the bottom of the file, add the following:

java_home=/usr/local/java/jdk1.8.0_91

Path= $PATH: $HOME/bin: $JAVA _home/bin

Export Java_home

Export PATH

8. Save the/etc/profile file and exit edit.

9. Notification system, the new version of Oracle Java is available, use the following command to update

$sudo update-alternatives--install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_91/bin/java" 1

$sudo update-alternatives--install "/usr/bin/javac" "Javac" "/usr/local/java/jdk1.8.0_91/bin/javac" 1

$sudo update-alternatives--install "/usr/bin/javaws" "Javaws" "/usr/local/java/jdk1.8.0_91/bin/javaws" 1

10. Use the following command to set the JDK as default.

$sudo update-alternatives--set Java/usr/local/java/jdk1.8.0_91/bin/java

$sudo update-alternatives--set Javac/usr/local/java/jdk1.8.0_91/bin/javac

$sudo update-alternatives--set Javaws/usr/local/java/jdk1.8.0_91/bin/javaws

11. Update the system's environment variable path using the following command

$source/etc/profile

12. Reboot the system (I did not restart the system at that time, but jump to the 13th step directly, and no error)

13. Check the version of the JDK by running the $java-version command. If the installation is successful, it will appear as follows

[Email protected]> Java-version/usr/local/java
Java Version "1.8.0_91"
Java (TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot (TM) 64-bit Server VM (build 25.91-b14, Mixed mode)

 
四、启动android studio

After completing the JDK replacement OPENJDK, after re-executing $./studio.sh , display the following launch screen, carefully waiting for Android studio to launch.

Reference Links:

Http://askubuntu.com/questions/430434/replace-openjdk-with-oracle-jdk-on-ubuntu

Http://askubuntu.com/questions/492280/android-studio-not-working-tools-jar-classpath-error

(i) Basic environment construction of Android small app development

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.