Android simple example (generates "Hello World!")

1. Open eclipse.exe software, click on the menu bar File-> New-> Android the Application Project .

 

2. to the project named, usually begin with a capital letter, using "hump" nomenclature, and in the middle of example to get rid of, modify the package name. Finally, the SDK minimum version requirements set API8 target version of the compiler are set to Android 7.1.1 .

 

3. not considered other settings, continuous click the Next , until the changes to Actitity Name and Layout Name When revised to " MainActivity " and " main " (Note: Layout Name The name can not be capitalized).

 

4. Click Finish to complete the initial project to establish and determine your SDK is configured to 7.1.1 (see see "Configuring and methods of Android development environment ( Windows 64bit )" article).

 

5. After opening the layout of activity_main.xml , click on the scroll bar at the bottom left and right of the main page activity_main.xml , will Android: text = "TextView" in " TextView " changed to " the Hello World! ", Can Graphical Layout View results If the problem does not show appears, you can check in the upper right corner Automatically Pick Best . 

 

7. The error correction within the system, first AndroidManifest file, will be reported @ drawable / ic_launcher this is not recognized, because the res this icon file is not in the picture folder, and in the mipmap-hdpi under (or mdpi , etc.), from hdpi paste a copy of the picture to the next drawable-hdpi , the error that is eliminated.

 

 

8. The system error 2 , i.e. MainActivity.java occur within R error occurs R CAN BE Not resolved to variable A , there are several possibilities here because AndroidManifest file 8 unsolved problems caused R library is not generated, all questions after all resolved in the menu bar Project in Clean look, just fine.

 

9. The system error 3 , the MainAcitivity.java file header modification inheritance Activity class, rather than the other, while leaving only below the OnCreate () method.

 

10. After the plug Ruan Zhuo phone, right-click on the left menu bar Company Engineering -> the Run As-> 1 Android the Application , select the SDK to 7.1.1 simulator, a god simulator, or cell phone you can download and start this project a. Specifically, how to control what open the project in Run As- Run Configuretions> The target can be adjusted in.

 

11. Select the appropriate phone, click " the OK " to generate App , or not even mobile phones, AVD display can be on, if a god simulator, then the requirements for the x86 , the original SDK to 4.4.2 should not be compatible.

Guess you like

Origin blog.csdn.net/HoD_DoH/article/details/53579152