This lesson shows you how to create a new Android project with Android Studio and describes some of the files in the project.
In Android Studio, create a new project:
If you don't have a project opened, in the Welcome to Android Studio window, click Start a new Android Studio project.
If you have a project opened, select File > New Project.
In the New Project screen, enter the following values:
Application Name: "My First App"
Company Domain: "example.com"
Android Studio fills in the package name and project location for you, but you can edit these if you'd like.
In the Target Android Devices screen, keep the default values and click Next.
The Minimum Required SDK is the earliest version of Android that your app supports, which is indicated by the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the core feature set, enable that feature only when running on the versions that support it (see Supporting Different Platform Versions).
In the Add an Activity to Mobile screen, select Empty Activity and click Next.
In the Customize the Activity screen, keep the default values and click Finish.
After some processing, Android Studio opens and displays a
"Hello World" app with default files. You will add functionality to some of these files in the following lessons.
Now take a moment to review the most important files. First, be sure that the Project window is open (select View>Tool Windows>Project) and the Android view is selected from the drop-down list at the top. You can then see the following files:
This file appears in Android Studio after the New Project wizard finishes. It contains the class definition for the activity you created earlier. When you build and run the app, the Activity starts and loads the layout file that says
This XML file defines the layout of the activity. It contains a TextView element with the text
The manifest file describes the fundamental characteristics of the app and defines each of its components. You'll revisit this file as you follow these lessons and add more components to your app.
Android Studio uses Gradle to compile and build your app. There is a build.gradle file for each module of your project, as well as a build.gradle file for the entire project. Usually, you're only interested in the build.gradle file for the module. in this case the app or application module. For more information about this file, see Building Your Project with Gradle.
To run the app, continue to the next lesson.