Android development will be used in future work, so if you want to build a development environment, your laptop will be installed with win7
Prepare the file:
1. Download the Android SDK
Http://code.google.com/android/download.html
Windows 7 is installed in the same way as Windows XP.
2 download JDK6
Http://java.sun.com/javase/downloads/index.jsp
3. Download Eclipse3.4.1
Http://www.eclipse.org/downloads/
For Eclipse, you can directly decompress the package and use it.
4. Download the Android ADT plug-in of Eclipse
Many tutorials are downloaded through the Eclipse update function at this step:
Start Eclipse and choose Help> Soft Updates> Find and Install ...]
Select the "Available Software" tab and click "Add Site ...] Press the key. Add update site: https://dl-ssl.google.com/android/eclipse/
In this case, the "https://dl-ssl.google.com/android/eclipse/option" option is added to the window. Select this option and click "Installation Details ...] Click the button to download.
Note: many domestic users cannot complete such upgrades. Generally, this is not reflected in the first half (Other plug-ins, such as pydev ).
It doesn't matter. Go to the Android official website to download this ADT plug-in:
Http://code.google.com/android/adt_download.html
After the download is complete, decompress the package and copy the files in the "features" and "plugins" directories to the corresponding Eclipse directory.
Installation and configuration process:
1. Install JDK
Run jdk-6u14-windows-i586.exe
Check whether JDK is successfully installed. Open the cmd window and enter java-version to view the JDK version.
2. Install Eclipse
Directly decompress Eclipse3.4.1.zip to the specified directory, for example, F: \ Android \ eclipse.
Run eclipse.exe, set Workspace, and specify a Development Directory for it.
The following page is displayed. Eclipse installation is complete.
3. Install android-sdk-windows-1.5_r3.zip
Like Eclipse, Android SDK can be decompressed directly. I can decompress the SDK to the folder F: \ Android.
Add the absolute PATH of the tools in the Android SDK to the system PATH.
Open "System Properties" and select "environment variable"
Add the PATH value of the environment variable to the absolute PATH of the tools in the SDK, as shown in figure
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.
4. Install Android Development Tools (ADT)
Open Eclipse IDE
Choose "Help"-> "Software Updates" from the menu"
Go to the tab "Available Software"-> "Add Site"-> "Location:" Enter
Http://dl-ssl.google.com/android/eclipse
Check "Android DDMS" and "Android Development Tools", as shown in "Install:
All the way to Next, pay attention to the Accept license until it is complete.
"Yes" restart "Eclipse" to complete installation.
5. Set "SDK Location"
Open Eclipse IDE
Choose "Window"> "Preferences" from the menu"
Open the "Preferences" window and select "Android"
In the error window that appears, set "SDK Location" to the SDK installation directory.
"OK", open this window again, and you can see the SDK list
6. Verify the development environment and create a HelloWorld test program.
Choose "File"> "New"> "Project" from the Eclipse IDE menu"
Select "Android Project" and click "Next ".
Complete the basic information. (Note that if Android1.5 is selected in the last column, "Min SDK Version" must be 3)
Close the Welcome window of Eclipse after creation.
The project you just created
Next, create the Android Virtual Device AVD.
Open the cmd console and run the android list target command to view available platforms.
Create an avd according to the android create avd-name <AVD name>-target format.
This completes the custom Android Virtual Device.
Finally, configure "Run Configuration" of "Eclipse"
Choose "Run"-> "Run deployments" from the menu"
Double-click "Android Application" to create a new configuration file and set the Name item
Specify the "Project" Project in the "Android" tab on the right
Select the self-created "AVD" and "Apply" on the "Target" tab on the right, and then click "Run"
Select the Boot Method "Android Appliaction"
Normally, you can see the Simulator Interface.
But an error occurred on my side,
[02:16:07-HelloWorld] Automatic Target Mode: Preferred AVD 'sdk _ lifecycle 5' is not available. Launching new emulator.
[02:16:07-HelloWorld] Launching a new emulator with Virtual Device 'sdk _ lifecycle 5'
[02:16:07-Emulator] emulator: ERROR: unknown virtual device name: 'sdk _ register 5'
[02:16:07-Emulator] emulator: cocould not find virtual device named 'sdk _ register 5'
The reason is that I moved the MyDocument folder of the system and found the ". android" folder in the root directory of the folder where MyDocument is located and copied it to the "C: \ Users \ [current user name]" directory.
Ctrl + F11, successfully enters the simulator.
If you have other questions, try "Project"-> "Clean" current Project and regenerate it.
Simple demo Test
Create an Android Project
After the development environment is set up, let's create a Hello World project to experience Android development.
1. Choose 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 (Package name, refer to Java related concepts): com. china. hello
Activity name (Class name of the UI window, inherited from Activity): HelloChina
Application name: test Android
This completes the creation of an Android project.
In the Package Explorer window, select the [src]> [com. china. hello]> [HelloChina. java] file and edit the Code:
Package com. china. hello;
Import android. app. Activity;
Import android. OS. Bundle;
Import android. widget. TextView;
Public class HelloChina extends Activity {
/** Called when the activity is first created .*/
@ Override
Public void onCreate (Bundle saveInstanceState ){
Super. onCreate (saveInstanceState );
// SetContentView (R. layout. main );
TextView TV = new TextView (this );
TV. setText ("helloWorld ");
SetContentView (TV );
}
}
Run
Select "Android Application" in the "Run As" window. The simulator window shown in Figure 1 will appear in a short time:
Figure 1 Android Simulator
Click the "MENU" key in the simulator to unlock the program, as shown in figure 2.