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
- Go to developer.android.com/studio
- Download the installer for your operating system (Windows, macOS, or Linux)
- Run the installer and follow the setup wizard
- 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
- Open Android Studio → click New Project
- Select Empty Activity → click Next
- Set:
- Name: MyFirstApp
- Package name: com.estudy247.myfirstapp
- Language: Kotlin
- Minimum SDK: API 24 (Android 7.0) covers ~96% of devices
- 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
- Click Device Manager in Android Studio
- Click Create Virtual Device
- Choose a phone (e.g., Pixel 6), select a system image (API 34), click Finish
- Press the green Run button (▶) in Android Studio
On a Real Device
- On your phone, go to Settings → About Phone and tap Build Number 7 times
- This enables Developer Options
- Go to Developer Options → USB Debugging and turn it on
- Connect your phone to your computer with a USB cable
- 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()
