Click the Create AVD button. Close the Android SDK and AVD Manager dialog box.

71

Chapter 3: Your First Android Project

Figure 3-16: A new, manually created launch configura- tion named Example Config- uration . Congratulations You’ve created your first launch configuration by hand. Duplicating your launch configuration for quick setup At some point, during your very successful and lucrative Android develop- ment career, one of your applications may have a problem on one particular device. Launch configurations are designed to help you launch into a par- ticular environment quickly. Setting up many launch configurations can be a time-consuming task, however — especially if the launch configuration needs to be altered only slightly from an existing launch configuration. Fortunately, the ADT has included functionality that duplicates existing launch configura- tions, which allows you to quickly create various launch configurations that are set up independently with their own configuration in mind. To duplicate an existing launch configuration, follow these steps:

1. Make sure that the launch configuration window is open.

If it’s not, choose Run➪Run Configurations to open the launch configura- tion window. 72 Part II: Building and Publishing Your First Android Application

2. In the left panel, right-click ExampleConfiguration, and choose Duplicate from the context menu.

This step creates a new launch configuration that’s an exact copy of ExampleConfiguration. Its name will be ExampleConfiguration 1. 3. Change the name of the run configuration by typing DuplicateTest in the Name field near the top of the window. You have created a duplicate launch configuration, and now you can change various settings to give the launch configuration a unique configuration. You don’t need the DuplicateTest launch configuration; it was cre- ated to illustrate how to duplicate an existing launch configuration. 4. To delete this configuration, select DuplicateTest in the left panel and click the Delete button on the toolbar, or right-click it and choose Delete from the context menu.

5. Click the Close button to close the Run Configurations dialog box.

Running the Hello Android App Congratulations You’ve made it Understanding the basics of how to get an Android application up and running has been a simple yet detailed process. You’re now ready to see your hard work in action. You’ve created a launch configuration and Android Virtual Device; now it’s time for you to get the application running. Finally Running the app in the emulator Running the application is simple. Upon your instruction, the ADT will launch an emulator with the default launch configuration you built earlier in this chapter. Starting your application is as simple as choosing Run➪Run or pressing Ctrl+F11. Either action launches the application in an emulator using the default launch configuration — in this case, ExampleConfiguration. The ADT compiles your application and then deploys it to the emulator. If you didn’t create a launch configuration, you see the Run As dialog box, shown in Figure 3-17. Choose Android Application, and a launch configura- tion is created for you. 73

Chapter 3: Your First Android Project