Create an Android Project previous page next page you should also read
This lesson shows you how to use Android Studio to create a new Android project and describe some of the files in the project.
- In Android Studio, create a new project:
- If you do not have a project open, in the Welcome to Android Studio window, click Start a new Android studio project.
- If you have already opened the project, select File > New Project.
- In the New Project screen, enter the following values:
- application Name: "My first App"
- Company Domain: "example.com"
Android Studio populates the package name and project location for you, but you can also edit the content as needed.
- Click Next.
- On the Target Android Devices screen, leave the default values and click Next.
The Minimum Required SDK is the lowest Android version your app can support, represented by the API level. To support as many devices as possible, you should set it up to provide your app with the lowest available version of the core feature set. If any of the features you apply can only run on newer versions of Android and are not part of the core feature set, you can enable the feature only if it is running on a version that supports that feature (see Support for different platform versions).
- In the Add an activity to Mobile screen, select Empty Activityand click Next.
- In the Customize the Activity screen, leave the default values and click Finish.
After some processing, Android Studio opens and displays the "Hello World" app that contains the default file. In the following lessons, you will add functionality to some of these files.
Let's take a moment to review the most important files: first, make sure that you have the Project window open (choose View > Tool Windows > Project) and select from the drop-down list at the top Android view. You can then see the following files:
-
Apps > Java > Com.example.myfirstapp > Mainactivity.java
-
After you complete the New Project Wizard, the file appears in Android Studio. It contains the class definition of the Activity you created earlier. When you build and run the app,
Activity
it starts and loads the display "Hello world!" Layout file.
-
Apps > Res > Layout > Activity_main.xml
-
This XML file defines the layout of your Activity. It contains the text "Hello world!" The
TextView
element.
-
Apps > Manifests > Androidmanifest.xml
-
The manifest file describes the basic characteristics of the app and defines each of its components. You will use this file over and over again as you learn more about the course and add more components to your application.
-
Gradle Scripts > Build.gradle
-
Android Studio uses Gradle to compile and build your app. Each module of your project has a corresponding
build.gradle
file, and the entire project also has a corresponding
build.gradle
file. Usually you only care about the files of the module (in this case,
app
or the application module)
build.gradle
. For more information about this file, see Building your project with Gradle.
To run the app, go on to the next lesson.
Android Studio set or modify the Android SDK path
Everything you should know when using Android studio for the first time
Create an Android project