Creating a new Android project is the first step to build your own mobile app. It sets up all the files and tools you need to start coding.
Creating a new Android project in Android Kotlin
1. Open Android Studio. 2. Click on 'New Project'. 3. Choose a project template (e.g., Empty Activity). 4. Enter your app name, package name, and save location. 5. Select language as Kotlin. 6. Choose minimum SDK version. 7. Click 'Finish' to create the project.
The project template helps you start with some basic code and layout.
The minimum SDK version decides which Android devices your app can run on.
Open Android Studio > New Project > Empty Activity > Name: MyFirstApp > Language: Kotlin > Minimum SDK: API 21 > FinishOpen Android Studio > New Project > Basic Activity > Name: WeatherApp > Language: Kotlin > Minimum SDK: API 23 > FinishThis is the main activity Kotlin file created by default. It loads the layout file activity_main.xml which shows a "Hello World!" message.
package com.example.myfirstapp import android.os.Bundle import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) } }
Android Studio automates many setup steps so you can focus on coding.
Always choose Kotlin for new Android projects as it is the recommended language.
You can change the app name and package later but it is easier to set them correctly at the start.
Creating a new Android project sets up your app's structure and files.
Use Android Studio's wizard to pick templates, name your app, and select Kotlin.
The default code shows a "Hello World!" screen ready for you to add your app features.
Practice
Solution
Step 1: Open Android Studio
You start by launching Android Studio, the official tool for Android development.Step 2: Select 'New Project'
From the welcome screen, you choose 'New Project' to begin setting up your app.Final Answer:
Open Android Studio and select 'New Project' from the welcome screen -> Option DQuick Check:
First step = Open Android Studio and start new project [OK]
- Trying to write code before creating a project
- Skipping Android Studio and using other tools
- Downloading apps instead of creating one
Solution
Step 1: Choose the programming language option
During project setup, Android Studio asks which language to use for your app.Step 2: Select Kotlin for modern Android development
Kotlin is the recommended language for Android apps, so you pick Kotlin here.Final Answer:
Kotlin -> Option AQuick Check:
Language choice = Kotlin [OK]
- Choosing Java instead of Kotlin
- Selecting unsupported languages like Python
- Not selecting any language
Solution
Step 1: Understand the Empty Activity template
This template creates a simple app with minimal UI: a single TextView displaying 'Hello World!' by default.Step 2: Run the app to see the default UI
When you run the app, it shows 'Hello World!' text on screen with no buttons.Final Answer:
A screen showing 'Hello World!' text with no buttons -> Option BQuick Check:
Empty Activity default UI = 'Hello World!' screen [OK]
- Expecting buttons or lists by default
- Thinking the app shows a list automatically
- Confusing error messages with default UI
Solution
Step 1: Understand the error meaning
'ActivityNotFoundException' often means the app can't find the starting point (launcher activity).Step 2: Check AndroidManifest.xml for launcher activity
If no launcher activity is set, the app crashes because it doesn't know which screen to show first.Final Answer:
You did not set a launcher activity in the manifest -> Option CQuick Check:
Missing launcher activity = crash [OK]
- Assuming language choice causes this error
- Blaming Android Studio version without checking manifest
- Thinking device connection causes activity errors
Solution
Step 1: Review available templates
Empty Activity gives a 'Hello World!' screen; Basic Activity includes a button (FAB) and text by default.Step 2: Choose Basic Activity for UI elements
Basic Activity template sets up a screen with a button and text, ready for interaction.Final Answer:
Basic Activity -> Option AQuick Check:
UI with button = Basic Activity [OK]
- Choosing Empty Activity expecting UI elements
- Selecting No Activity which has no UI
- Using Fullscreen Activity which is for immersive apps
Ready to prove it?
Pass the test and this pattern moves unknown
