Android basics: Use eclipse to build an android development environment and create the first Android Project (Windows platform)

Source: Internet
Author: User

1. Build an android Development Environment

Preparation: Download eclipse, JDK, Android SDK, and ADT plug-in

: Eclipse: http://www.eclipse.org/downloads/

JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html

Android SDK: http://developer.android.com/sdk/index.html

ADT: http://developer.android.com/tools/sdk/eclipse-adt.html

1. install and configure the Java Development Environment:

① Install the prepared eclipse and JDK on the local machine (preferably in the full English path) and configure the environment variables for JDK. The JDK variable value is the root directory of the JDK installation path, for example, my files are D: \ Program Files \ Java \ jdk1.7.0 _ 02;

② Open the command prompt (CMD) and enter the Java-version command. If the command is displayed, the Java environment variable is configured.

2. Install the ADT Plugin:

① Open the installed eclipse, select "help" on the menu bar, and click "install new software..." in the pop-up drop-down box ...";

② In the new dialog box, you can directly enter the following in "Work with": Begin.

③ We recommend that you install the ADT plug-in package directly (this method can be performed in an offline environment ). The procedure is as follows: in the new dialog box, click "add"-> In the displayed dialog box, click "ARCHIVE" to select the ADT plug-in package that has been downloaded and saved to the local disk, the above "name" can be obtained at will. It is just a code name and has no practical effect.

④ After clicking the "OK" button in the previous step, we will find two check boxes in the blank space in the middle. Click the "select all" button to select all check boxes ", if "accept" is required, select "accept" until you click "finish" to complete the installation of the ADT plug-in. The time required for the entire process depends on the machine performance. After the ADT plug-in is installed, a row of Android icons will appear in the eclipse toolbar, such:

3. Install the SDK:

① Install the downloaded Android SDK on the local machine (preferably in full English) and configure environment variables for the android SDK. The environment variable value of Android SDK is the path of the platform-Tools Folder and the Tools Folder subdirectory under the SDK installation directory. For example, my environment variables are: e: \ my studying \ Android-SDK \ platform-tools, E: \ my studying \ Android-SDK \ tools. In the variable values, the two paths are separated by commas.

② Open the command prompt (CMD) and enter the Android-H and ADB commands respectively. If the command is displayed, the environment variables of the android SDK have been configured.

③ Open the installation directory of the android SDK and double-click "SDK manager"-> In the window that appears, select the SDK version you want to install. "status" indicates whether the SDK package is installed, for example, I chose "android2.2 (API 8)" (I have already installed it, so "status" is "installed")-> click "install packages... "button. In the displayed window, select" accept all "to install all the packages you just selected.-> click" Install "to start installation, the whole process will be slow, which requires your patience.

In addition, you can click the icon in the toolbar of eclipse to open "SDK manager" and install it. This is the same as the SDK installation method above.

④ Finally, choose "Windows"> "preferrnces" on the es main menu ";

⑤ In the displayed dialog box, select "android" on the Left bar-> use "Browse..." on the right... select the SDK installation path root directory-> click the "OK" button at the bottom, so that the SDK is loaded successfully on Eclipse.

 

4. Create an android simulator (AVD ):

① Open eclipse-> click the indicator icon on the eclipse toolbar to open the "android virsual Device Manager" window;

② In the "android virsual Device Manager" window, click the "new" button-> in the pop-up window, "name" can be retrieved at will; "target" refers to the system version of the simulator; the "size" of "SD card" refers to the size of the mobile phone memory card. As long as you do not have too many applications installed on the simulator, it is enough to give 20 or 30 mb; "skin" refers to the screen resolution size. "built in" is the standard screen resolution size commonly used by mobile phones, and "resolution" is used to customize the screen resolution size, you can select one based on your situation. -> After everything is set, click "create AVD". A simulator is created. If necessary, we can create multiple simulators for testing.

Appendix: Android Simulator model and corresponding resolution size:

Standard Width   Height Dar Pixeis
Hvga 480 * 320 3: 2 153,600
Qvga 320 * 240 4: 3 76,800
Wqvga400 400 * 240 5: 3 96,000
Wqvga432 432 * 240 9: 5 103,680
Wvga800 800 * 480 5: 3 384,000
Wvga852 854 * 480   409,920

So far, the android development environment has been successfully set up in eclipse. Let's see how to create the first Android project.

 

2. Create an android Project

① Open eclipse, click "file"-> move the cursor to "new"-> in the pop-up list box, if the option item "android Applicaion project" is displayed, click this option directly. Otherwise, select "other..." at the bottom... ", in the pop-up window, expand" android ", select" android Applicaion Project ", and then" Next ";

 

In fact, there is another way to directly click the icon shown in the eclipse toolbar:

② Fill in the relevant information as prompted in the new pop-up window, all the way "Next" until you click "finish", so that the first AndroidProgramYou can see that there is an additional Android project on the left of eclipse.

 

3. Compile the android Project

Select a project as shown in the following figure. Right-click the project and select "Run as" in the displayed list box. Click "Android Application". The simulator is automatically started, after the simulator is fully started, you can see the compilation result of the project. Are you familiar with seeing something? Actually, this is what you did when creating this project. Start your android journey.

 

If there is anything wrong with the above description, please make a brick!

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.