0
0
Android Kotlinmobile~5 mins

Creating a new Android project in Android Kotlin

Choose your learning style9 modes available
Introduction

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.

When you want to start building a new Android app from scratch.
When you want to practice Android development with a fresh setup.
When you need to create a sample app to test ideas or learn new features.
When you want to organize your app code and resources in one place.
Syntax
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.

Examples
This creates a simple app with one screen using Kotlin.
Android Kotlin
Open Android Studio > New Project > Empty Activity > Name: MyFirstApp > Language: Kotlin > Minimum SDK: API 21 > Finish
This creates an app with a toolbar and floating button ready to customize.
Android Kotlin
Open Android Studio > New Project > Basic Activity > Name: WeatherApp > Language: Kotlin > Minimum SDK: API 23 > Finish
Sample App

This is the main activity Kotlin file created by default. It loads the layout file activity_main.xml which shows a "Hello World!" message.

Android Kotlin
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)
    }
}
OutputSuccess
Important Notes

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.

Summary

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.