After the Android folder is expanded, click Android Project and then click the Next button. In the Project Name field, type Hello Android.

61

Chapter 3: Your First Android Project

The Min SDK Version defines the minimum version code of Android that the user must have before he can run your application. Note that this field is not required to create your app. For more information, see the section “Understanding the Build Target and Min SDK Version settings,” later in this chapter.

11. Click the Finish button.

You’re done You should see Eclipse with a single project in the Package Explorer, as shown in Figure 3-6. Figure 3-6: The Eclipse development environment with your first Android project, Hello Android. Deconstructing Your Project The Android project generated by Eclipse is a fresh clean project with no compiled binary sources. Sometimes, it takes a second for Eclipse to catch up to how fast you are, so you may notice little oddities about the system. You also need to understand what happens under the hood of Eclipse at a high level; I cover this information in the next sections. 62 Part II: Building and Publishing Your First Android Application Responding to error messages If you were quick enough to look or if your computer runs on the slower edge of the spectrum, you may have noticed a little red icon that hovered over the Hello Android folder icon in the Package Explorer in your Eclipse window right after you clicked the Finish button. If you didn’t see it, you can see an example in Figure 3-7. That icon is Eclipse’s way of letting you know that something is wrong with the project in the workspace. Figure 3-7: A project with errors in Eclipse. A project with errors in Eclipse By default, Eclipse is set up to let you know when an error is found within a project with this visual queue. How can you have an error with this project? You just created the project through the New Android Project wizard; what gives? Behind the scenes, Eclipse and the Android Development Tools are doing a few things for you: ✓ Providing workspace feedback: This feedback lets you know when a problem exists with any of the projects in the workspace. You receive notification in Eclipse via icon overlays, such as the one shown in Figure 3-7. Another icon overlay you may see often is a small yellow warning icon, which alerts you to some warnings in the contents of the project. ✓ Automatically compiling: By default, Eclipse autocompiles the applica- tions in your workspace when any files within them are saved after a change. If you don’t want automatic recompilation turned on, you can turn it off by choosing Project➪Build Automatically. This disables the automatic building of the project. If this option is deselected, you need to build your project manu- ally by pressing Ctrl+B each time you change your source code. So why are you getting an error with the first build? When the project was added to your workspace, Eclipse took over, and in conjunction with the ADT, it determined that the project in the workspace had an error. The issue that raised the error in Eclipse was that the gen folder and all its con- tents were not present. I cover the gen folder in “Understanding Project Structure,” later in this chapter.