Original URL:
Http://www.cnblogs.com/skynet/archive/2010/04/12/1709892.html
Introduction
This series is suitable for 0 basic personnel, because I am starting from 0, this series record I step into the Android development of some experience sharing, hope and June Mutual encouragement! As a new person in the Android team I, if there is something wrong, but also hope to enlighten.
Before starting the Android development journey, first build the environment and then create a simple HelloWorld. The topics in this article are as follows:
- 1. Environment construction
- 1.1. JDK Installation
- 1.2. Eclipse Installation
- 1.3. Android SDK Installation
- 1.4. ADT Installation
- 1.5. Create AvD
- 2, HelloWorld
1. Environment Construction
1.1. JDK Installation
If you do not have the JDK, you can go here to download, the next task is to install the prompt step-by-step. The steps for setting environment variables are as follows:
- The following environment variables are added to the system variables, such as environment variables, properties---
- The Java_home value is: D:\Program files\java\jdk1.6.0_18 ( the directory where you installed the JDK )
- The Classpath value is:.; %java_home%\lib\tools.jar;%java_home%\lib\dt.jar;%java_home%\bin;
- Path: Append%java_home%\bin at the beginning;
- Note: setting environment variables in the previous four steps is not necessary for building an Android development environment and can be skipped.
After the installation is complete, you can check that the JDK is installed successfully. Open the cmd window and enter Java–version to view the version information for the JDK. A screen similar to the following shows that the installation was successful:
Figure 1, verifying that the JDK installation is successful
1.2. Eclipse Installation
If you still have eclipse, you can download it here and download the win 32bit version of Eclipse IDE for Java Developers (92M) as shown:
Figure 2, Eclipse download
Can be used after decompression.
1.3. Android SDK Installation
Download Android-sdk_r05-windows.zip on Android developers and unzip to any path when download is complete.
- Run SDK Setup.exe, and click Available Packages. If you do not see an installable package, click Settings, select "Force https://..." in misc, and then click Available Packages.
- Select the SDK and its documentation or other packages you wish to install, click Installation Selected, Accept all, install Accepted to begin downloading and installing the selected package
- The new path value in the user variable is: the tools absolute path in the Android SDK (this machine is D:\AndroidDevelop\android-sdk-windows\tools).
Figure 2, setting environment variables for Android SDK
After "OK", restart the computer. After restarting the computer, go to the cmd Command window and check that the SDK is installed successfully.
Run Android–h If you have output similar to the following, it indicates that the installation was successful:
Figure 3, verifying that the Android SDK is installed successfully
1.4. ADT Installation
- Open the Eclipse IDE and go to "help", "Install New Software" in the menu
- Click Add ... button, the pop-up dialog asks you to enter name and location:name yourself, location input http://dl-ssl.google.com/android/eclipse. As shown in the following:
- After determining the return, select the ADT we just added in the drop-down list after work with, and we'll see the developer Tools below that expand it will have Android Ddms and Android development Tool, tick them. As shown in the following:
- Then just follow the prompts step by step next.
After completion:
- Choose Window > Preferences ...
- On the left panel select Android, then on the right click Browse ... and check the SDK path, this machine is:
D:\AndroidDevelop\android-sdk-windows
- Click Apply, OK. Configuration is complete.
1.5. Create AVD
To enable Android applications to run on the emulator, you must create an AVD.
- 1. In Eclipse. Select Windows > Android SDK and AVD Manager
- 2. Click Virtual Devices on the left panel, then click New on the right.
- 3, fill in the name, select the target API,SD card size arbitrary, skin random choice, hardware currently keep the default value
- 4. Click Create AVD to complete the AVD creation
Note: If you click on the left panel of virtual Devices, and then click New on the right, and the target drop-down list is not available, then you:
- Click Available Packages on the left panel and tick https://dl-ssl.google.com/android/repository/repository.xml on the right, as shown in:
- Then click the Install Selected button and follow the prompts.
To do both of these, the reason is that in 1.3, the Android SDK installation did not install some of the necessary available packages (Available Packages).
2, HelloWorld
- Create a new project "Android Project" Through the Project menu, file-I
- Then fill in the necessary parameters as shown in: (Note here I checked the Google APIs, you can choose what you like, but you want to create the appropriate AVD)
Description of the relevant parameters:
- Project name: The names of the folders that contain this project.
- Package Name: Packages name, following Java specification, it is important to distinguish different classes by package name, I use Helloworld.test.
- Activity name: This is the main class name of the project, and this class will be the subclass of the activity class of Android. An activity class is a simple launcher and control program class. It can create an interface as needed, but it is not required.
- Application Name: An easy-to-read title on your application.
- The "Use default location" option in the "Selection bar" allows you to select an existing project.
- After clicking Finish, click on the eclipse's Run menu to select Run configurations ...
- Select "Android Application", click on the upper left corner (button like a piece of paper with a "+" number) or double-click "Android Application", there is a new option "New_configuration" ( can be changed to our favorite name ).
- In the right Android panel, click Browse ..., select HelloWorld
- Tick the appropriate AVD in the automatic of the target panel, and if there is no AVD available, you need to click on the manager in the lower right corner and create the appropriate AVD. As shown in the following:
- Then click the Run button, and if successful, there will be an Android emulator interface, as shown in:
"Turn" Android Development Tour: Environment Construction and HelloWorld