This lesson shows you how to create a new Android project with Android Studio and describes some of the files in the project.
First of all , be sure you have installed the latest version of Android Studio. Download Android Studio here.😄
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.Helloworldapp > MainActivityThis is the main activity (the entry point for your app). When you build and run the app, the system launches an instance of this
app > res > layout > activity_main.xmlThis XML file defines the layout for the activity’s UI. It contains a
The manifest file describes the fundamental characteristics of the app and defines each of its components.Gradle Scripts > build.gradleYou’ll see two files with this name: one for the project and one for the “app” module. Each module has its own
The following pages teach you how to build a simple Android app. You’ll learn how to create a “Hello World” project with Android Studio and run it.
First of all , be sure you have installed the latest version of Android Studio. Download Android Studio here.😄
- In the Welcome to Android Studio window, click Start a new Android Studio project.Or if you have a project opened, select File > New Project.
- In the Create New Project window, enter the following values:
- Application Name: “Hello world App”
- Company Domain: “example.com”
- Click Next.
- In the Target Android Devices screen, keep the default values and click Next.
- In the Add an Activity to Mobile screen, select Empty Activity and click Next.
- In the Configure Activity screen, keep the default values and click Finish.
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.Helloworldapp > MainActivityThis is the main activity (the entry point for your app). When you build and run the app, the system launches an instance of this
Activity
and loads its layout. app > res > layout > activity_main.xmlThis XML file defines the layout for the activity’s UI. It contains a
TextView
element 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.gradleYou’ll see two files with this name: one for the project and one for the “app” module. Each module has its own
build.gradle
file, but this project currently has just one module. You’ll mostly work with the module’s build.gradle
file to configure how the Gradle tools compile and build your app.Run your app on an android device
Set up your device as follows:- Connect your device to your development machine with a USB cable. If you’re developing on Windows, you might need to install the appropriate USB driver for your device.
- Enable USB debugging in the Developer options as follows.First, you must enable the developer options:
- Open the Settings app.
- (Only on Android 8.0 or higher) Select System.
- Scroll to the bottom and select About phone.
- Scroll to the bottom and tap Build number 7 times.
- Return to the previous screen to find Developer options near the bottom.
- In Android Studio, click the app module in the Project window and then select Run > Run (or click Run in the toolbar).
- In the Select Deployment Target window, select your device, and click OK.