
Building Cross-Platform Apps with Kotlin Multiplatform: A Practical Guide
Building a cross-platform app with Kotlin Multiplatform means placing reusable Kotlin code in shared source sets and keeping target-specific code where Android, iOS, or another platform requires it. You can share only business logic or also share UI with Compose Multiplatform; one project does not mean every line is identical.
This architecture works best when the team decides the sharing boundary before choosing libraries. Start with product requirements, native SDK dependencies, release targets, and team skills, then decide what belongs in common code.
What is Kotlin Multiplatform?
JetBrains defines Kotlin Multiplatform as an open-source technology for sharing Kotlin code across Android, iOS, desktop, web, and server targets while retaining the benefits of native development. A project uses shared source sets such as common code plus target source sets for platform implementations.
That flexibility is the defining feature. A team can share validation and networking in an existing native app, share most domain and data code, or build a shared Compose Multiplatform interface.
What should you share first?
Good first candidates have clear inputs, outputs, and tests: API clients, serialization, domain models, validation, business rules, caching, and data repositories. These modules provide reuse without forcing an immediate UI rewrite.
Platform services such as secure storage, push notifications, purchases, camera access, and authentication often need target-specific setup even when a shared interface coordinates them. Design those boundaries explicitly rather than hiding platform differences.
Do you need Compose Multiplatform?
No. Kotlin Multiplatform and Compose Multiplatform solve different layers. KMP shares Kotlin code; Compose Multiplatform is JetBrains' framework for sharing declarative UI. The official documentation describes both shared UI and interoperability with SwiftUI, UIKit, and other native views.
Choose native UI when platform-specific interaction and independent native teams are more important than maximum reuse. Choose shared Compose UI when consistent product screens and a Kotlin-centered team make UI reuse more valuable. A hybrid is valid.
How is a KMP project structured?
- Define targets: decide which Android, iOS, desktop, web, or server outputs the product truly needs.
- Create shared modules: put portable domain, data, and selected UI code in common source sets.
- Implement platform contracts: use target source sets for platform APIs and SDK integrations.
- Keep platform entry points: Android and iOS still initialize and package their applications through their own toolchains.
- Test at both levels: run common tests for shared logic and platform tests for integrations, UI behavior, and release builds.
JetBrains' project-structure guide explains the shared and platform-specific source-set model in detail.
What tooling is required?
KMP uses Kotlin and Gradle. Android development uses Android Studio or IntelliJ IDEA tooling. iOS builds, signing, simulator/device testing, and App Store publishing still require Xcode and Apple's toolchain. Version compatibility between Kotlin, Gradle, the Android Gradle plugin, Compose Multiplatform, and Xcode should be checked before upgrading.
How should you handle native services?
Wrap the capability behind a shared contract and implement the platform-specific pieces separately when necessary. For example, the shared code can request a subscription entitlement while Android and iOS configure their store products, credentials, and platform SDK behavior independently.
The same principle applies to notifications, authentication providers, deep links, analytics consent, secure storage, and background work. Shared orchestration does not remove platform policies.
How do you test a cross-platform app?
- Unit-test business rules and data transformations in common code.
- Test target implementations against Android and iOS APIs.
- Run UI and accessibility checks on representative devices for both platforms.
- Test release builds, signing, deep links, notifications, purchases, and offline recovery.
- Measure app size, startup, rendering, and network behavior rather than assuming code sharing guarantees performance.
What does KMP Kit add?
KMP Kit packages a plan-based starting structure for common mobile infrastructure. The free Discover plan lists basic setup, navigation, and dependency injection; paid plans add different combinations of networking, notifications, CI/CD, authentication, payments, local data, analytics, and tests. Compare the exact plan scope and setup documentation before requesting repository access.
A starter kit does not replace application architecture decisions, service credentials, Apple and Google developer accounts, privacy review, device testing, or product-specific code.
Frequently asked questions
What is Kotlin Multiplatform?
Kotlin Multiplatform is an open-source JetBrains technology for sharing Kotlin code across Android, iOS, desktop, web, and server targets while retaining access to platform-specific APIs.
Do Kotlin Multiplatform apps use one codebase?
They use one project with shared and platform-specific source sets. A team chooses how much to share; app entry points and some integrations remain specific to Android or iOS.
Is Compose Multiplatform required for KMP?
No. Teams can share business logic with Kotlin Multiplatform and build native interfaces with Jetpack Compose and SwiftUI, or use Compose Multiplatform to share UI as well.
Do I need Xcode for a KMP iOS app?
Yes. Apple targets still require the Apple toolchain for building, signing, testing, and publishing the iOS application.
What should be shared first in an existing app?
A contained business-logic or data module with clear boundaries is usually a lower-risk first step than immediately sharing the entire user interface.
What does a starter kit replace?
A starter kit can provide repeatable project structure and selected integrations. It does not replace product requirements, credentials, platform accounts, security review, device testing, store compliance, or app-specific engineering.
Primary sources
- JetBrains: What is Kotlin Multiplatform?
- JetBrains: Kotlin Multiplatform project structure
- JetBrains: Compose Multiplatform
- JetBrains: KMP compatibility guide
Reviewed July 20, 2026. Confirm tool and platform versions in the linked official documentation.