kmp-project-structurelisted
Install: claude install-skill iammohdzaki/kmp-skills
# KMP Project Structure (2026+)
> **IMPORTANT — Structure Changed**
>
> The KMP project structure has changed significantly. The old single-module layout where
> `composeApp` held both shared code and the Android app entry point is **deprecated** and
> incompatible with AGP 9.0+.
>
> Always scaffold new projects using the **new multi-module layout** described in this skill.
> Use the [KMP Wizard](https://kmp.jetbrains.com/) to generate a reference project if unsure.
---
## Old vs New Structure
### Old Structure (pre-2026 / AGP < 9.0) — Do NOT use for new projects
```
MyApp/
├── composeApp/ ← ⚠️ Mixed: shared code + Android app entry point
│ ├── build.gradle.kts ← applies com.android.application + kotlin.multiplatform
│ └── src/
│ ├── commonMain/kotlin/…
│ ├── androidMain/kotlin/… ← MainActivity lives here
│ └── jvmMain/kotlin/…
├── iosApp/ ← Xcode project
├── gradle/libs.versions.toml
├── build.gradle.kts
└── settings.gradle.kts
```
**Problem**: AGP 9.0 forbids `com.android.application` (or `com.android.library`) from
coexisting with `org.jetbrains.kotlin.multiplatform` in the same module.
---
### New Structure (AGP 9.0+ / KMP 2.2+) — Use this for all new projects
```
MyApp/
├── shared/ ← KMP library module (all shared code + shared UI)
│ ├── build.gradle.kts ← applies com.android.kotlin.multiplatform.library + kotlin.multiplatf