Build and install an android development environment in Linux

Source: Internet
Author: User

I learned linux for a month when I was programming in C language in linux. I am familiar with some commands and can fulfill some daily requirements in linux, I have also set up and installed an android development environment. However, after a long time, I forgot all the previous things. Since I didn't record the steps for setting up the environment at that time, I am blind again and have done a lot of effort, after completing the setup, record it and prepare for the future.

To do good deeds, you must first sharpen your tools.

Build and install an android Development Environment

1. Install jdk and configure jdk Environment Variables

First, download jdk from the http://java.sun.com, my version is jdk1.6.0 _ 12, I download binfile, I will download jdk1.6.0 _ 12. binfile is placed in/usr/lib/jvm/java (directory arbitrary. If a binfile exists in a directory such as "Download", copy the binfile to the/usr directory. the/usr directory is mainly used to store some software used in the ubuntu system, similar to the program files directory in windows, you must first modify the binfile permission and run the following command in shell:

Sudo chmod u + x/usr/lib/jvm/java/jdk1.6.0 _ 12.bin modify the binfile permission so that it can be executed.

Sudo/usr/lib/jvm/java/jdk1.6.0 _ 12.bin (install jdk)

Subtitles will appear. Press enter until yes/no is required for the screen display. Enter y and press Enter. The jdk will be decompressed to the folder to get the jdk 1.6.0 _ 12 directory.

Jdk has been installed. Jdk will be installed in the directory where the source file is located. Configure the jdk environment variables as follows.

Run:

Sudo vi/etc/environment

In environment, the following section appears:

Reference:

PATH = "......:/usr/lib/jvm/java/jdk1.6.0 _ 12/bin" (there are quotation marks in this place. Neither classpath nor java_home is quotation marks)

CLASSPATH =.:/usr/lib/jvm/java/jdk1.6.0 _ 12/lib

JAVA_HOME =/usr/lib/jvm/java/jdk1.6.0 _ 12

Run:

Source/home/username/. bashrc (The sudo command cannot be run before the source command, because the source command does not belong to the system command)

At this time, the environment variables are successfully set (there are many ways to set the environment variables, not to list them one by one)

Ubuntu 10.10 comes with the default jdk-openjdk. Therefore, we need to perform the following work to make the jdk installed by default.

Run:

Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/java/jdk1.6.0 _ 12/bin/java 300

Format: sudo update-alternatives -- install/usr/bin/java: jdk bin directory/java 300

Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jvm/java/jdk1.6.0 _ 12/bin/javac 300

Same format as above

In this step, add the installed jdk to the java menu.

Then execute:

Update-alternatives -- config java

In this step, select the default jdk

In this way, enter the following in shell:

When java-version is used, it indicates that the system uses sun's java. So far, jdk is successfully installed and environment variables are successfully set.

2. Install ADT

For installation instructions, see the development documentation.

3. Install Android sdk

3.1 you can download the sdk by yourself or copy other people's sdks. This is not important. The key is to configure the environment variables of the sdk.

3.2 configure the sdk Environment Variables

The directory structure of the sdk has changed since android 2.3. An additional plthforms-tools Folder is added, and the directory contains the tools folder in the adb file, because you cannot only configure the environment variables of the tools folder, you also need to configure the environment variables of the platforms-tools Folder. The configuration method is the same as that of the java environment variables, add the paths of the two folders one by one after the Path. After the configuration is complete, enter adb in the command line. If this command is not displayed, restart the system and then click OK.

So far, Android has been set up in the development environment of ubuntu.

4. Install eclipse and plug-ins

One problem encountered when installing eclipse is that the automatic prompt box of Eclipse is black, which is very uncoordinated. How to change it,

When the latest version of Eclipse 3.6 and the latest version of Ubuntu theme (I am using 10.04 now, but I don't know which version I started to change this theme) encounter a problem: in the edit box, the automatic tooltip background is black, and the text in the result prompt is also black. As shown in:

This is because the Tooltip background in the Ubuntu topic is black but the foreground color is white. This background color is applied to Eclipse, however, because the font color set by Eclipse does not change with the editor (the middle part is purple and the part is black), some are purple under the black background, the black character disappears.

Solution]

To solve this problem, you must change the background color of Tooltip In the Ubuntu topic. You can find it in the following menu:

System-> preferences-> appearance-> topic-> Custom (a button)-> color (Tab)-> tooltip

The corresponding English system should be:

System-> preference-> appearance-> theme-> custom-> color-> tooltip

The default configuration is: black background, foreground white. Change to: the foreground is black and the background is yellow (you can decide on your own )... At this time, Eclipse should be back to normal.

Plugin: findbugs,

Subclipse (: http://subclipse.tigris.org/serv... F89EF? PageID = p4wYuA)

The subclipse tutorial will not be used yet. It will be summarized after a while.

When subclipse is installed, the JAVAHL library may not be found.

Solution:

Run the sudo apt-get -- fix-missing install libsvn-java command to install the library, and add-Djava. library. path =/usr/lib/jni under eclipse. ini.

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.