After the basic environment is set up, you can develop the SDK. However, you need to manually install the virtual device in the latest SDK version.
1. AVD is called Android virtual device, which is a virtual device running on Android. It is recognized by the android simulator. To run a created Android program, you must create an AVD. You can configure many running projects on each AVD. I understand that a virtual mobile phone device is customized on a PC. There are two ways to create AVD. The first is the elcipse development environment, and the second is the creation through the command line.
1. Create an eclipse development environment:
(1) AVD is a virtual Android phone in a computer. For the new SDK version, you must manually add AVD to the SDK directory, such as D:/Android-SDK-windows, and run the SDK manager.exe.
(2) Click "Virtual Devices" on the Left bar and click "new" on the right. The create dialog box is displayed. Give this SVD a name, such as the mobile phone model hero, set target to an Android version, and SD card to the virtual svd sd card capacity (at least 8 Mb), and then set the resolution, for example, 320*480, then add the special device required for this AVD in hardware, such as the keyboard. Finally, click "create AVD.
2. Create a command line: Find the path of tools in the command line mode, and enter the command: Android create AVD -- Target 2 -- name my_avd. Android is the command, followed by the parameter, create AVD is the creation of AVD, Target 2 is the level, and name is the name of AVD.
3. Set AVD in eclipse (this item is mostly used to develop a program of a fixed type. If it is not set, a prompt will be prompted to manually select AVD during each debugging)
Run eclipse. On the menu bar "run" | "Run deployments", select Android Application, select a configuration, select "target" on the right, and then select an AVD.
2. Create the first Android Program-Hello World
1,Create a new Android Project
Open eclipse and select File> New> project. If the android Eclipse plug-in is correctly installed, an "android" item is displayed in the pop-up dialog box. Select "android project" and click Next.
[NOTE: If eclipse does not list this project after the project is created, because it is not set to display it, select package explorer in the menu bar "window" | "show View. Right-click the created Project testdemo in package explorer on the left, select the last "properties", and then select "Run/debug settings ", add "android JUnit test" to "new" on the right, select "target" in the pop-up settings, and select an AVD. Finally, right-click Project testdemo in package explorer on the left and select "Run as" | "Android Application ". You can see that a virtual Android phone is successfully started.]
2,Enter detailed information about the project.
In addition to the package name, we can fill in helloworld. The activity name entered here is the class name of the activity after your project is created. Select the AVD device you have created in build test. Do not select the device you have not created. Otherwise, the debugging fails. For example
3. The created project structure is as follows:
[Note: If you are running the IDE environment for the first time, you need to switch to the workbench mode, as shown in]
4. If there is no accident, find our helloword project, right-click and select "run", and select Android Application to run the helloword application. This process is a bit long, wait a moment to see the Simulator Interface ..
There are a lot of learning examples in the SDK. Once you get started, you can start to learn more by referring to the application in the sample! The running result is as follows:
Iii. Other considerations:
1. When creating a project, note that the API level of the AVD virtual machine required for running the target must be consistent with the project min SDK version. Otherwise, compilation fails.
2. When setting the Virtual Machine AVD, set built -- In: hvga to automatically adjust the screen size without running the interface outside the screen.
3. If you want to use WVGA but cannot display the interface completely, you can set the AVD display ratio.
StartEclipse is running configuration... Set the parameter-scale 0.6 in additional emulator command line options. For example, do not remember to drag the dialog box bigger.