Step 1 of 15
Create a new Android project, understand project structure, configure SDK versions, run on emulator
เริ่มต้นสร้าง Android project, ทำความเข้าใจโครงสร้างโปรเจกต์, รันบน emulator
Open Android Studio and create a new project:
MyAppcom.example.myappAndroid Studio downloads Gradle and builds the project. The first build takes a few minutes.
Diagram: The key files and folders of an Android project.
Loading diagram...
| Path | Purpose |
|---|---|
settings.gradle.kts | Lists modules and plugin/version management |
build.gradle.kts (project) | Plugins and SDK locations |
app/build.gradle.kts | Module dependencies, minSdk, targetSdk, app id |
AndroidManifest.xml | Declares the app, activities, and permissions |
MainActivity.kt | The entry activity, hosts your Compose UI |
res/ | Themes, strings, colors, images |
// app/build.gradle.kts
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose) // Compose compiler (K2)
}
android {
namespace = "com.example.myapp"
compileSdk = 35
defaultConfig {
applicationId = "com.example.myapp"
minSdk = 24
targetSdk = 35
versionCode = 1
versionName = "1.0"
}
buildFeatures {
compose = true
}
}
dependencies {
val composeBom = platform("androidx.compose:compose-bom:2025.06.01")
implementation(composeBom)
implementation("androidx.activity:activity-compose:1.10.1")
implementation("androidx.compose.material3:material3")
}
Key terms:
minSdk = 24 — the oldest Android version the app supportstargetSdk = 35 — the Android version the app targets (API 35 = Android 15)compileSdk = 35 — the SDK used to compile (must be >= targetSdk)<!-- AndroidManifest.xml -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="MyApp"
android:theme="@style/Theme.MyApp">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The <intent-filter> with MAIN and LAUNCHER marks MainActivity as the screen shown when the user taps the app icon.
Control + R)You should see the default Compose template — a greeting text centered on screen.
// Emulator output:
// Hello Android!
Create a new project, then change the greeting in MainActivity.kt to show your own name. Run it on the emulator and confirm your name appears on screen.