Kotlin Android Setup

Building Android apps with Kotlin requires Android Studio — the official IDE from Google and JetBrains. This topic walks you through installation, project creation, and the structure of a real Android project.

Installing Android Studio

  1. Go to developer.android.com/studio
  2. Download the installer for your operating system (Windows, macOS, or Linux)
  3. Run the installer and follow the setup wizard
  4. During setup, let Android Studio install the Android SDK, emulator, and build tools automatically

System Requirements

Requirement   | Minimum
--------------|---------------------------
RAM           | 8 GB (16 GB recommended)
Disk Space    | 8 GB free (SSD preferred)
OS            | Windows 10+, macOS 10.14+, Linux 64-bit

Creating Your First Kotlin Android Project

  1. Open Android Studio → click New Project
  2. Select Empty Activity → click Next
  3. Set:
    • Name: MyFirstApp
    • Package name: com.estudy247.myfirstapp
    • Language: Kotlin
    • Minimum SDK: API 24 (Android 7.0) covers ~96% of devices
  4. Click Finish. Android Studio generates the project.

Android Project Structure

MyFirstApp/
├── app/
│   ├── src/
│   │   └── main/
│   │       ├── java/com/estudy247/myfirstapp/
│   │       │   └── MainActivity.kt        ← Your Kotlin code
│   │       ├── res/
│   │       │   ├── layout/
│   │       │   │   └── activity_main.xml  ← UI design file
│   │       │   ├── values/
│   │       │   │   ├── strings.xml        ← Text strings
│   │       │   │   └── colors.xml         ← Color definitions
│   │       │   └── drawable/              ← Images, icons
│   │       └── AndroidManifest.xml        ← App configuration
│   └── build.gradle.kts                   ← App-level build config
├── build.gradle.kts                       ← Project-level build config
└── settings.gradle.kts                    ← Module settings

AndroidManifest.xml — App Configuration

This file declares every Activity in your app and sets permissions your app needs from the user.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:label="@string/app_name"
        android:theme="@style/Theme.MyFirstApp">

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

MainActivity.kt — The Entry Point

package com.estudy247.myfirstapp

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}

onCreate is the first method Android calls when your Activity starts. setContentView loads the XML layout file and draws it on screen.

build.gradle.kts — Dependencies

dependencies {
    implementation("androidx.appcompat:appcompat:1.7.0")
    implementation("com.google.android.material:material:1.12.0")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
    testImplementation("junit:junit:4.13.2")
}

Running Your App

On an Emulator

  1. Click Device Manager in Android Studio
  2. Click Create Virtual Device
  3. Choose a phone (e.g., Pixel 6), select a system image (API 34), click Finish
  4. Press the green Run button (▶) in Android Studio

On a Real Device

  1. On your phone, go to Settings → About Phone and tap Build Number 7 times
  2. This enables Developer Options
  3. Go to Developer Options → USB Debugging and turn it on
  4. Connect your phone to your computer with a USB cable
  5. Press the green Run button — your app installs on the phone

Diagram — Android App Lifecycle (Overview)

App Launched
     │
     ▼
onCreate()   ← app first created, set up UI here
     │
     ▼
onStart()    ← app becomes visible
     │
     ▼
onResume()   ← app is in foreground, user can interact
     │
     ▼ (user presses Home or another app opens)
onPause()    ← app partially hidden
     │
     ▼
onStop()     ← app not visible
     │
     ▼ (user returns to app)
onRestart() → onStart() → onResume()
     │
     ▼ (app closed)
onDestroy()

Leave a Comment

Your email address will not be published. Required fields are marked *