This lesson shows you how to create a new Android project with Android Studio, and it describes some of the files in the project.
To create your new Android project, follow these steps:
- Install the latest version of Android Studio.
In the Welcome to Android Studio window, click Start a new Android Studio project.
If you have a project already opened, select File > New > New Project.
- In the Select a Project Template window, select Empty Activity and click Next.
- In the Configure your project window, complete the following:
- Enter "My First App" in the Name field.
- Enter "com.example.myfirstapp" in the Package name field.
- If you'd like to place the project in a different folder, change its Save location.
- Select either Java or Kotlin from the Language drop-down menu.
- Select the lowest version of Android your app will support in the Minimum SDK field.
- If your app will require legacy library support, mark the Use legacy android.support libraries checkbox.
- Leave the other options as they are.
- Click Finish.
After some processing time, the Android Studio main window appears.
Now take a moment to review the most important files.
First, be sure the Project window is open (select View > Tool Windows > Project) and the Android view is selected from the drop-down list at the top of that window. You can then see the following files:
- app > java > com.example.myfirstapp > MainActivity
- This is the main activity. It's the entry point for your app. When you build and run your app,
the system launches an instance of this
Activityand loads its layout.
- app > res > layout > activity_main.xml
- This XML file defines the layout for the activity's user interface (UI). It contains a
TextViewelement with the text "Hello, World!"
- app > manifests > AndroidManifest.xml
- The manifest file describes the fundamental characteristics of the app and defines each of its components.
- Gradle Scripts > build.gradle
- There are two files with this name: one for the project, "Project: My First App," and one for
the app module, "Module: app." Each module has its own
build.gradlefile, but this project currently has just one module. Use each module's
build.gradlefile to control how the Gradle plugin builds your app. For more information about this file, see Configure your build.
To run the app, continue to the next lesson, Run your app.