Kotlin Multiplatform
KMP is a sharing mechanism, not a promise that both apps use the same UI or SDK. Resolve the module and target graph before choosing Android, iOS or shared-code guidance.
| Question | Read |
|---|---|
| Which code and dependencies can be shared? | references/source-sets.md |
| How does shared Kotlin reach the iOS app? | references/apple-interop.md |
| Is UI shared with Compose Multiplatform or native on each target? | references/compose-ui.md |
| Which build, measurement or release task applies? | references/build-performance.md |
Ground the answer
- Read
settings.gradle.kts, the affected module'sbuild.gradle.kts, version catalog and source-set directories. Record the configured targets;androidMainandiosMainare not proof that a target is built in CI. - Trace a real symbol from
commonMainthrough an interface orexpectdeclaration to each configured implementation and its Android/iOS caller. Name the module, source set and owner at every boundary. For shared Compose UI, trace its host entry too. - Match validation to the changed boundary: shared Kotlin tests on configured targets, target tests for
actualimplementations, and host UI/device tests for behavior that crosses into Android or iOS. A JVM test is not iOS coverage. - Use the topic skill for the requested work. Use
mobile-androidormobile-iosonly for an affected host or target-specific implementation; do not apply native-app instructions blindly tocommonMain.
The Kotlin Multiplatform source-set reference defines commonMain, commonTest and target compilations. Confirm DSL and task names in the project's installed Kotlin and Gradle versions.