Complete illustration of the Android Development Environment

Source: Internet
Author: User

This article describes how to build an Android development environment in Linux starting from 0.

 

If you are a reader of Learning Android, you can also refer to this article, because this article is based on the installation method in the book. (If you are not, it doesn't matter. The steps are the same anyway :))

 

The so-called Android development environment mainly consists of the following two components: Android Software Developer Kit (Android Software development Kit) and Eclipse (Editor, which provides many convenient functions, the following describes their installation methods.

 

 

Install Eclipse

 

To install Eclipse, first install Java Developer Kit (JDK, Java Developer Kit) and Java Runtime Environment (JRE, Java Runtime Environment ).

 

Use the pacman Package Manager that comes with ArchLinux for installation:

 

 

Shell code
$ Sudo pacman-S jdk jre
 


If you are using Ubuntu, you can use apt-get for installation. But before installing jdk and jre, You need to first install the ia32-libs package, specific reference: http://developer.android.com/sdk/installing.html#troubleshooting.

 

After JDK and JRE are installed, install Eclipse:

 

 

Java code
$ Sudo pacman-S eclipse
[Java] view plaincopy
$ Sudo pacman-S eclipse
 
After the installation is successful, open Eclipse and try again.

 

 


 

 

After a while, we still need to work on Eclipse, but now we need to first install the Android software development kit before we can complete Eclipse installation.

 

 

Install the Android SDK)

 

To install the Android software development kit (, first go to the http://developer.android.com/sdk/index.html, depending on your system, select the appropriate package to install.

 

Here suppose you use Linux and download the android-sdk_r11-linux_x86.tgz (r11 is the version number, there may be a change) to unpackage:

 

 

Shell code
$ Tar xvf android-sdk_r11-linux_x86.tgz


This completes the first step of installing the Android software development Kit. The reason why this is the "First Step" is because the package that has just been decompressed is called Android Developer Kit Starter, it is only part of the entire Android Development Kit. A complete Android software development kit that can be run includes the following three components:

Android SDK tools
Android SDK Platform-tools
SDK Platform Android
Android SDK tools is the package we just downloaded, to provide debugging and testing tools for development (detailed list: http://developer.android.com/guide/developing/tools/index.html#tools-sdk), and to provide updates to the entire software kit.

The Android SDK Platform-tools provides the software required for the Platform (that is, different versions of the Android system.

SDK Platform Android, Android Platform, SDK core, provides the library and code required for development, divided into versions (such as 2.2, 3.1, etc ).

 

We have downloaded the Android SDK tools. Now we need to use it to obtain the Android SDK Platform-tools and SDK Platform Android.

 

Run SDK tools:

 

 

Shell code
$ Mv android-sdk-linux_x86/android # rename the file set for convenience
 
$ Cd android/tools/
 
$./Android
 
Then a window pops up. You can switch to "Installed packages" to see which packages are Installed.

At the beginning, only Android SDK Tools is available by default (that is, the one selected in the image). Here, there are two other options because I have installed them ).

 

 


 

 

The next task is to install the Android SDK Platform-tools and SDK Platform Android. Select "Avaliable packages" and you will find many optional packages.

 

The Android SDK Platform-tools must be installed, and the SDK Platform Android has multiple versions. you can install them according to your choice, but you have to install at least one program, or you won't be able to run the program, such as 2.2, 3.1, 3.2, and so on. select a suitable one for your installation.

 

The SDK Platform Android version is best selected based on your reference materials. For example, if you are reading 3. for books of Version x, you can use version 3. the version of x, and if you are reading 2. for the books of Version x, install 2. version x, otherwise it may cause trouble.

 

Learning Android uses Version 2.2, so I will install Version 2.2.

 

Check the Android SDK Platform-tools and the SDK Platform Android you Selected, and click "Install Selected". After the download and installation are complete, switch back to "Installed packages ", make sure that the selected package has been installed.


(Note: In the demo, I selected SDK Platform Android of Version 2.1, nor Android SDK Platform-tools, because I have installed it .)

 

 

 

 


Continue Eclipse Installation

 

I just mentioned that the installation of the Eclipse editor has been completed, but it is not enough because Eclipse provides a lot of useful plug-ins to facilitate the development of Android programs, therefore, we also need to install the relevant plug-ins so that we can get twice the result with half the effort by writing code later.

 

Open your Eclipse and click Help-> Install New Software... on the menu bar...

 

 

 

 

 

In the displayed dialog box, click "Add,

 

 


 

 

In the pop-up box, enter a Name for the Name field. Here I use Android Plugin, and copy the following address in the Location field:

Https://dl-ssl.google.com/android/eclipse/

 

 

 

 

 

Then, return to the previous window and you will see several software packages. Check them and click "Next->.

 

 


 

 

Then click "Finish" to complete the plug-in installation.

 

 

What should I do if an error occurs during plug-in installation ?!

 

If Eclipse detects that the dependency is not met, it will prompt an error (as follows) asking you to solve the dependency. (I personally think it is stupid not to solve the dependency on its own .)

 

(I am prompted by the error message. I tried to install the existing plug-ins again because I have installed all the plug-ins)

 


 

 

Things won't always go smoothly, and the same is true for software, but this is life ~

 

If you encounter the following errors during installation, follow my steps to solve these problems.

 

 

Error_info code
Cannot complete the install because one or more required items cocould not be found.
 
Software being installed: Android Development Tools 11.0.0.v201105251008-128486 (com. android. ide. eclipse. adt. feature. group 11.0.0.v201105251008-128486)
 
Missing requirement: Android Development Tools 11.0.0.v201105251008-128486 (com. android. ide. eclipse. adt. feature. group 11.0.0.v201105251008-128486) requires 'org. eclipse. gef 0.0.0 'but it cocould not be found
 
In this case, you have not installed a plug-in named "GEF". You can add this plug-in to solve this problem.

 

Just like adding the Android plug-in, click the Add button to copy the name and address of the GEF plug-in, and then click next to install the GEF plug-in.

 

The address of the GEF plug-in is http://download.eclipse.org/tools/gef/updates/releases/

 

 


 

 

OK, then you can try to install the Android plug-in again. In Work with, select the previously entered Android plug-in option, and then try to re-execute the operation.

 

 


 

 

Plug-ins or errors!

 

I almost want to roar !! After installing the GFE plug-in, I tried to install the Android plug-in, but Eclipse reported an error again. The error message is:

 

 

Error_info code
Cannot complete the install because one or more required items cocould not be found.
 
Software being installed: Android Development Tools 11.0.0.v201105251008-128486 (com. android. ide. eclipse. adt. feature. group 11.0.0.v201105251008-128486)
 
Missing requirement: Android Development Tools 11.0.0.v201105251008-128486 (com. android. ide. eclipse. adt. feature. group 11.0.0.v201105251008-128486) requires 'org. eclipse. wst. sse. core 0.0.0 'but it cocould not be found
 
Fortunately, with the last experience, we have been able to calmly deal with such problems. This solution is more clever. We will take three steps:

 

1. Click the Add button, copy the following address, the name is helios, and then confirm: http://download.eclipse.org/releases/helios

2. Click the "Avaliable Software Sites" Link under the "Add" button. In the displayed box, tick helios and confirm. (Note that you do not need to install any helios plug-in here. Add the address, click the link, tick it, and confirm it .)

3. In Work with, select the previously entered Android Plugin option, and then try to re-execute the installation.

 

The three steps are shown as follows:

 

(1)

 


(2)

 
(3)

 
(4)


 

Finally...

After some tossing, the Android plug-in is finally installed. We must also associate the address of the Android software development kit with Eclipse so that Eclipse can use the code in the kit.

Click "Window-> Preferences" in the menu bar and click the "Android" page on the left.

In the Location item, open the downloaded and decompressed SDK tools Folder (I am/home/huangz/android), and click "Apply, in this way, your Android Platform can be identified.

Click OK.

 

 

Finally, we can start to create our Android Project...

Click "File-> New-> Other" in the menu bar and find "Android Project".

 

 

 

 

 

 

If Google pops up at this time, ask you to feedback the SDK and ignore it first.

 

Fill in the project information in the project interface, for example, the name "HelloWorld", the Package Manager uses its own domain name, my name is "me. sideeffect", and then confirm.

 

 

 

 

 

 

 

 

The default project file is generated. Next we can try to add a virtual machine and then simulate an Android phone on the computer.

 

Click "Window-> Android SDK and AVD manager" in the menu bar"

 

 


 

 

The interface is the development tool we used before. Now we need to use it to create a virtual machine.

 

Click "new" in the menu on the right.

 

 

 

 


The following options are described as follows:

 

Name: Virtual Machine Name.

Target: The Target platform. Here, select your own Android version. Here, we will use version 2.2.

SD Card: the size of the hard disk space in the virtual phone, which can be set as needed.

Snapshot: Snapshots. After the check box is selected, the status of the virtual machine can be saved. You do not need to reset the settings every time. This option also helps to quickly start the virtual machine, but correspondingly, the storage speed slows down.

Skin: the screen size of your Vm, which can be set as needed.

Hadrware: hardware of your virtual machine, which can be set according to your needs.

 

After everything is done, press CreateAVD.

 

 

 

 


After a virtual machine is created, it will naturally let him run. Select the virtual machine, click Start in the window, and a window will pop up later. Generally, simply press Lanch ~

 

 

 


Introduction
This series is suitable for people with 0 basics, because I started from 0. This series records my experience in Android development and I hope to share it with you! As a newcomer to the Android team, I hope to give you some advice if there is anything wrong.

Before starting the Android development journey, you must first build an environment and then create a simple HelloWorld. The topic of this article is as follows:

1. Establish the environment
1.1 JDK Installation
1.2 install Eclipse
1.3 Android SDK Installation
1.4 ADT Installation
1.5 create AVD
2. HelloWorld
1. Establish the environment
1.1 JDK Installation
If you do not have a JDK, you can download it here. The next step is to install the SDK step by step. To set environment variables, follow these steps:

Choose my computer> Properties> advanced> environment variables> system variables to add the following environment variables:
JAVA_HOME: D: \ Program Files \ Java \ jdk1.6.0 _ 18 (your JDK installation directory)
CLASSPATH value:.; % JAVA_HOME % \ lib \ tools. jar; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ bin;
Path: Start appending % JAVA_HOME % \ bin;
NOTE: Setting environment variables in the previous four steps is not necessary for building an Android development environment. You can skip this step.
After the installation is complete, check whether the JDK is successfully installed. Open the cmd window and enter java-version to view the JDK version. The following figure shows that the installation is successful:

 

Figure 1. Verify that JDK is successfully installed

1.2 install Eclipse
If you still have Eclipse, you can download the Eclipse IDE for Java Developers (92 M) win 32bit version as shown in:

Figure 2. Eclipse download

Decompress the package and use it.

1.3 Android SDK Installation
Download android-sdk_r05-windows.zip from Android codecs and decompress it to any path.

Run SDK Setup.exe and click Available Packages. If no package is Available, click Settings, select "Force https: //..." In Misc, and then click Available Packages.
Select the SDK you want to Install and its documentation or other packages. Click Installation Selected, Accept All, and Install Accepted to download and Install the Selected packages.
In the user variable, create the absolute PATH (D: \ AndroidDevelop \ Android-SDK-windows \ tools) in the path value of android sdk ).
Figure 2. Set the environment variables of the Android SDK

After "OK", restart the computer. After restarting the computer, enter the cmd command window and check whether the SDK is successfully installed.
If android-h has the following output, the installation is successful:

Figure 3. Verify that the Android SDK is successfully installed

1.4 ADT Installation
Open Eclipse IDE and choose "Help"-> "Install New Software" from the menu"
Click Add.... In the displayed dialog box, enter Name and Location: Name, and enter http://dl-ssl.google.com/android/eclipse. As shown in:


After the return result is confirmed, select the ADT we just added from the drop-down list after work with. We will see the Developer Tools below, which will show Android DDMS and Android Development Tools, select them. As shown in:


Next, follow the prompts to proceed to the next step.
After completion:

Select Window> Preferences...
Select Android on the left-side panel, Click Browse... on the right side, and select the SDK path. The local machine is:
D: \ AndroidDevelop \ android-sdk-windows
Click Apply and OK. Configuration complete.
1.5 create AVD
To enable the Android Application to run on the simulator, you must create an AVD.

1. In Eclipse. Choose Windows> Android SDK and AVD Manager
2. Click Virtual Devices in the left-side pane, and then click New on the right side.
3. Fill in the Name and select the Target API. the SD Card is of any size and the Skin option is selected. Currently, the default value of Hardware is used.
4. Click Create AVD to Create an AVD.
Note: If you click Virtual Devices in the left-side pane and New in the right-side pane, but the target drop-down list does not have any options, you can:

Click Available Packages in the left-side pane, and check https://dl-ssl.google.com/android/repository/repository.xmlon the right, as shown in:


Click the Install Selected button and then follow the prompts.
The reason for these two steps is that some necessary Available Packages (Available Packages) are not installed in 1.3 and Android SDK installation ).

2. HelloWorld
Use the File-> New-> Project menu to create a New Project "Android Project"
Then fill in the necessary parameters, as shown in: (Note that Google APIs is selected here. You can select what you like, but you need to create the corresponding AVD)


Description of related parameters:

Project Name: Name of the folder containing the Project.
Package Name: the Package Name follows the JAVA specification. It is important to use the Package Name to distinguish different classes. I use helloworld. test.
Activity Name: this is the main class Name of the project. This class will be a subclass of the Android Activity class. An Activity class is a simple class for starting and controlling programs. It can create an interface as needed, but not required.
Application Name: a readable title on your Application.
In the "Use default location" option in the "select bar", you can select an existing project.
Click "Finish" and select "Run deployments" from the "Run" menu of Eclipse...
Select "Android Application", click in the upper left corner (the button is like a "+" on a piece of paper), or double-click "Android Application ", there is a new option "New_configuration" (you can change it to our favorite name ).
On the right Android panel, Click Browse ..., Select HelloWorld
Select the corresponding AVD in the Automatic of the Target panel. If no AVD is available, click Manager in the lower right corner ..., Create an AVD. As shown in:


Click the Run button. If the operation succeeds, the Android Simulator Interface is displayed, as shown in:

 


And so on

 

 


 

 


OK! Finally! Our bumpy installation journey has come to an end.

Then you can start writing your Android program and start your Android journey ~ Good luck!
 

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.