Eclipse Android development and Configuration Guide

Source: Internet
Author: User

Build an Eclipse Android development and configuration Environment

1. Download the Android SDK

Http://code.google.com/android/download.html

This is the official website. after entering the website, follow the process and select an SDK package suitable for your own platform (Windows) to download.

After downloading, decompress the package and you can use it.

To directly use the SDK tool in the DOS console, you can add the SDK directory to the path environment variable in Windows:

Right-click my computer on the desktop, and choose Properties> advanced> environment variables ].

Double-click the Path entry in system variables to add the complete Path of the tools directory in the Android SDK to this directory.

2. Download JDK6

Http://java.sun.com/javase/downloads/index.jsp

Download and install the Java Development Kit. (I have downloaded and installed this file, and jdk is automatically updated every time)

3. Download Eclipse3.4.1

Http://www.eclipse.org/downloads/

On the "Eclipse Packages" tab, select "Eclipse Classic3.4.1" to download the package. This is the latest version.

For Eclipse, you can directly decompress the package and use it. (I have myeclipse 6.5)

4. Download the Android ADT plug-in of Eclipse

Install the Eclipse plug-in (ADT)

To download and install the ADT plug-in, follow the steps Google provides to developers:

1. Start Eclipse and select "Help"> "Software Updates"> "Find and Insta ll"

2. In the displayed dialog box, select Search for new features to insta ll and click New"

3. Click "New Remote Site"

4. In the result dialog box, enter a name (for example, Android Plugin) for the remote site and enter

This URL serves as its URL:

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

Click OK.

5. Now you should see that the new site is loaded into the search list (and selected) and click "Finish ".

6. In the subsequent search result dialog box, select "Android Plugin"> "Developer Tools" to check

Box. This will select the "Android Developer Tools" and "Android Editors" features.

The Android Editors feature is optional, but is recommended.

Click "Next"

7. Read the license agreement, select "Accept terms of th license agreement", and click "Next"

8. Click "Finish"

9. The ADT plug-in is not signed. In short, you can click "Insta ll All" to accept the installation.

10. Restart Eclipse

11. After the restart, update your Eclipse configuration to point to the SDK directory:

A. Select "Window"> "Preferences" to open the configuration panel. (Mac OS

X: "Eclipse"> "Preferences ")

B. Select "Android" from the left-side navigation pane"

C. For "SDK Location" in the main panel, click "Browse" and select the SDK directory Location

D. Click "Apply" and click "OK"

Finally, you can create a project.

Create an android Project

After the development environment is set up, let's create a Hello World project to experience Android development.

1. Select File> New> Project]

2. Choose Android> Android Project and click Next]

3. Create a new Android Project

Project name (directory name of the Project stored in the computer): HelloWorld

Package name (for details about the Package name, refer to Java concepts): com. china. hello

Activity name (Class name of the UI window, inherited from Activity): HelloChina

Application name (Application title name): test Android

Note: When creating an Android project, the Target name selected in Build Target must be the same as your list of existing Android virtual devices; otherwise, you must

You can start it manually.

This completes the creation of an android project.

In the Package Explorer window, select src> com. china. hello]> HelloChina. java to edit the Code:

 
 
  1. package com.china.hello; 
  2.  
  3.   
  4.  
  5. import android.app.Activity; 
  6.  
  7. import android.os.Bundle; 
  8.  
  9. import android.widget.TextView; 
  10.  
  11.   
  12.  
  13. public class HelloChina extends Activity { 
  14.  
  15.     /** Called when the activity is first created. */ 
  16.  
  17.     @Override 
  18.  
  19.     public void onCreate(Bundle saveInstanceState) { 
  20.  
  21.         super.onCreate(saveInstanceState); 
  22.  
  23.         //setContentView(R.layout.main); 
  24.  
  25.         TextView tv = new TextView(this); 
  26.  
  27.         tv.setText("helloWorld"); 
  28.  
  29.         setContentView(tv); 
  30.  
  31.     } 
  32.  

Run the project

Select "Android Application" in the "Run As" window. The simulator window will appear in a short time:

Click the "MENU" key in the simulator to unlock the program.

However, when I run my project for the first time, the following occurs:

No compatible targets were found Do you wish to a add new Android Virtual Device

Solution:

First, we should also consider adding the complete path of the tools directory in the Android SDK to the path.

Complete Eclipse Android development and configuration.

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.