Android basics use Eclipse to build an Android development environment and create the first Android project (Windows platform)

First, build the Android development environment

Preparation: Download Eclipse, JDK, Android SDK, ADT plugin

Download address: 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 machine (preferably under the full English path), and configure environment variables for JDK, where the variable value of JDK is the root directory of the JDK installation path, such as mine: D :\Program Files\Java\jdk1.7.0_02;

              ②Open the command prompt (cmd), enter the java -version command, and the following figure is displayed, indicating that the JAVA environment variable has been configured.

         2. Install the ADT plugin:

         ①Open the installed Eclipse, select "Help" on the menu bar -> click and select "Install new software..." in the pop-up drop-down box;

         ②In the newly opened dialog box, we can directly input in "Work with": https://dl-ssl.google.com/android/eclipse/ to install the ADT plug-in online, but since Google's server is built abroad, Therefore, it will be slower to install in this way, and there may be situations where the character is poor and cannot be installed, so online installation is not recommended.

         ③I recommend installing directly through the downloaded ADT plug-in zip package (this method can be done in an offline environment). The specific steps are: Click the "Add" button in the newly opened dialog box -> click the "Archive" button in the opened dialog box to select the ADT plug-in zip package that has been downloaded and saved on the local hard disk. As for the "Name" above You can take it at will, this is just a code name, it has no practical effect.

         ④After clicking the "Ok" button in the previous step, we will find that there are two lines of check boxes in the middle blank. Click the "Select All" button to select all the check boxes. After this step, all the way to "Next", you need to " "Accept", select "Accept", until you click "Finish" to end, so that the ADT plug-in is installed. The time required for the entire process depends on the performance of the machine. After installing the ADT plug-in, a row of Android icons will appear on the Eclipse toolbar, as shown below:

    

        3. Install the SDK:

              ① Install the downloaded Android SDK on the machine (preferably under the full English path), and configure environment variables for the Android SDK. The environment variable value of the Android SDK is the platform-tools folder and the subdirectory path of the tools folder under the SDK installation directory. For example, mine are: E:\My Studying\Android\android-sdk\platform-tools, E:\My Studying\Android\android-sdk\tools, in the variable value, separate the two paths with a comma.

             ②Open the command prompt (cmd), enter the android -h and adb commands respectively, and the following figure is displayed, indicating that the Android SDK environment variables have been configured.

            ③Open the installation directory of the Android SDK, double-click "SDK Manager" -> select the SDK version you need to install in the opened window, where "Status" indicates whether the SDK package is installed, for example, I chose "Android2.2 ( API 8)" (mine has been installed before, so "Status" is "Installed") -> click the "Install packages..." button, and it is best to select "Accept All" in the pop-up window so that you can Install all the packages you just selected -> finally click the "Install" button to start the installation. The whole process will be very slow, which requires your patience.

               In addition, we can also open the "SDK Manager" by clicking the icon indicated in the figure below in the toolbar on Eclipse and then install it, which is the same as the above SDK installation method, so there is no need to describe it.

            ④ Finally, select "Windows" on the main menu of Eclipes -> select "preferrnces";

            ⑤In the pop-up dialog box, select "Android" on the left column -> select the root directory of the SDK installation path through the "Browse..." button on the right -> click the "Ok" button at the bottom, so that the SDK is in Eclipse loaded successfully.

 

          4. Create an Android emulator (AVD):

               ①Open Eclipse->Click the icon indicated in the figure below on the Eclipse toolbar to open the "Android Virtual Device Manager" window;

               ②In the "Android Virtual Device Manager" window, click the "New" button -> in the pop-up window, "Name" can be taken at will; "Target" refers to the system version of the emulator; "size" of "SD Card" refers to The size of the mobile phone memory card, as long as you do not install too many applications on the simulator, generally 20 or 30 MB is enough; "Skin" refers to the resolution size of the screen, and "Built in" is the standard screen commonly used in general mobile phones. Resolution size, and "Resolution" is a custom screen resolution size, the specific method, you can choose according to your own situation. -> After everything is set, click "Create AVD", then an emulator is created. If necessary, we can create multiple emulators for testing.

              Attachment: Android emulator model and its corresponding resolution size:

Standard Width   Height BUT pixels
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 built on Eclipse. Let's see how to create the first Android project.

 

2. Create a new Android project

              ① Open Eclipse, click "File" in the menu bar -> move the mouse cursor to "New" -> in the pop-up list box, if you can see the "Android Applicaion Project" option directly, click this option directly , otherwise select "Other..." at the bottom, in the pop-up window, expand the "Android" item, select "Android Applicaion Project", and then "Next";

 

                    In fact, there is another way to directly click the icon in the Eclipse toolbar as indicated in the following figure:

                  ②In the new pop-up window, fill in the relevant information as shown in the figure below, and go all the way to "Next" until you click "Finish", so that the first Android program is created, and you will find that there is an additional one on the left side of Eclipse that you created. android project.

 

3. Compile the Android project

      Select the project as shown in the figure below -> click the right mouse button, select "Run As" in the pop-up list box -> click "Android Application", then you will find that the emulator starts automatically, wait until the emulator is fully started , you can see the compilation result of the project. Did you see something that looked familiar? In fact, that's what you did when you created this project, start your Android journey.

 

          

              If the above is inappropriate, welcome to Paizhuan!

Category: Android
 
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327036755&siteId=291194637