Mobile Apps
Adding Kotlin Multiplatform to an Existing Android App
If you have a mature Kotlin Android app and an iOS app that keeps falling behind, Kotlin Multiplatform lets you share the logic without a rewrite. Here is what moves, which dependencies need replacing and the gradual path we follow.

Many companies have a mature Android app written in Kotlin and an iOS app that is newer, thinner or missing altogether. Every rule change, from pricing to validation to sync, has to be built twice, and the two apps quietly disagree. Kotlin Multiplatform offers a way out that does not involve throwing away the Android app: move the shared logic into a module both apps use, one piece at a time.
This is one of the most common starting points in our Kotlin Multiplatform development work. We have written before about how KMP compares with Flutter and about one shared core serving several apps. This article is about the first step: introducing KMP into an Android codebase that already exists and must keep shipping.
What Moves and What Stays
Kotlin Multiplatform has been stable since late 2023, and the shared code is ordinary Kotlin compiled for each platform: JVM bytecode on Android, native code with an Objective-C and Swift interface on iOS. The Android app keeps its Jetpack Compose or XML user interface. What moves into the shared module is the code that should behave the same everywhere:
- Domain models and business rules: pricing, eligibility, validation, formatting of amounts and dates.
- Networking and API models: the client that talks to your back end, with its error handling and retries.
- Local storage and sync: the offline cache, the queue of pending changes and the logic that resolves conflicts.
- Analytics event definitions, so both apps send the same events with the same properties.
- Optionally, view models, since AndroidX ViewModel now supports multiplatform. Sharing them moves more logic out of each UI, at the cost of a stronger coupling to Kotlin patterns on iOS.
The user interface can be shared too, with Compose Multiplatform, which is now stable on iOS. For an existing app, though, we usually start with logic only and keep SwiftUI on iPhone; it is the lower-risk step, and UI sharing can be reconsidered later.
Audit the Dependencies First
Code can only move into the shared module if everything it uses is multiplatform. A typical Android app depends on several Android or JVM-only libraries, and the audit tells you how much work each feature will take:
- Retrofit and OkHttp become Ktor client calls. The API surface changes, but the models usually carry over.
- Gson or Moshi become kotlinx.serialization. Custom adapters need rewriting as serializers.
- Room now has multiplatform support, so an existing Room database can often move with fewer changes than switching to SQLDelight, which remains a good choice for new schemas. Either way, existing user data must migrate cleanly on upgrade.
- Hilt or Dagger are Android-only. Shared code typically uses constructor injection with Koin, or plain factories, while the Android app keeps Hilt and wires the shared classes into it.
- java.time becomes kotlinx-datetime, and RxJava becomes coroutines and Flow. If the app still relies heavily on RxJava, that conversion is often the biggest single task.
- DataStore supports multiplatform for simple settings.
Where a platform feature has no common library, Kotlin's expect and actual declarations, or a plain interface implemented on each side, let shared code call platform code such as secure storage or device information.
A Gradual Path Inside the Existing Project
- Add a shared module to the existing Gradle build, with Android and iOS targets. The Android app depends on it like any other module, so nothing changes for users.
- Move one self-contained piece first, such as validation rules or the API models, with its unit tests moved into commonTest using kotlin.test. The Android app now runs on the shared code, which proves it in production before iOS uses it.
- Replace JVM-only dependencies feature by feature, following the audit, keeping each change small enough to release.
- Publish the module to iOS as an XCFramework, consumed through Swift Package Manager, CocoaPods or a direct Xcode build phase, and call it from one SwiftUI screen.
- Widen the shared surface one feature at a time, removing the duplicated Swift code as each shared version proves itself.
Throughout, the Android app should be releasable at every commit. If a step forces a long-lived branch, it is too big.
Making the Shared Code Pleasant to Use From Swift
The iOS team's experience decides whether KMP succeeds. By default, Kotlin exposes an Objective-C style interface to Swift, which loses some information: sealed classes become plain class hierarchies, Flow is not directly usable as a Swift async sequence, and generics are limited. Suspend functions can be called with Swift's async and await, but cancellation needs care.
- Design a Swift-friendly API layer in the shared module: simple types, clear names, no leaking of Kotlin-specific constructs into what iOS calls.
- Use interop tools such as SKIE, which turns sealed classes into Swift enums and flows into async sequences, or KMP-NativeCoroutines. Kotlin's own direct Swift export is in development and will improve this further.
- Involve the iOS developers from the start. They should review the shared API, be able to read Kotlin, and be able to build the module on their own machines.
The UI itself stays native on each side; our comparison of SwiftUI and Jetpack Compose covers how those two toolkits differ.
Build, CI and Team Practicalities
- iOS builds need macOS. The shared module's iOS targets compile only on a Mac, so the CI pipeline needs macOS runners, and build times grow. Caching Gradle and Kotlin/Native output helps.
- Version the shared module so the iOS app can pin a known-good build while Android moves ahead, or keep everything in one repository so both apps always build against the same commit. Both work; choose deliberately.
- Agree ownership. Shared code needs reviewers from both platforms. Otherwise it drifts towards Android habits that are awkward on iOS.
- Watch the app size and startup on iOS, since the Kotlin runtime adds to the binary. In practice this is modest for logic-only sharing, but it should be measured.
The work spans both platforms, so we staff it from our Android and iOS app development teams together, and the shared networking layer is a natural point to tidy up the back-end contract through our API development and integration work.
Is It Worth It for Your App?
KMP pays off when there is real logic to share and both platforms will be maintained for years. It is less compelling when the app is mostly screens over a simple API, or when there is no iOS app planned. If you have a Kotlin Android app and an iOS app that keeps falling behind, tell us how the two codebases are structured today and we will suggest which piece to share first.
Frequently Asked Questions
Do we have to rewrite our Android app to use Kotlin Multiplatform?
No. Kotlin Multiplatform is added as a module inside the existing Android project. Code moves into it piece by piece, and the Android app keeps working and shipping throughout. The Android user interface does not need to change at all, and most existing Kotlin code moves across once its JVM-only dependencies are replaced.
Will our iOS developers have to write Kotlin?
They will need to read it and review changes to the shared module, and ideally contribute small changes. Day to day, they keep writing Swift and SwiftUI, calling the shared module like any other framework. Most iOS developers find modern Kotlin familiar because it is close to Swift in style.
Can we share the user interface as well as the logic?
Yes, with Compose Multiplatform, which is stable on iOS. If your Android app uses Jetpack Compose, many screens can be shared. We usually begin with logic only for an existing app, because it carries less risk and keeps the iOS app fully native, then consider sharing screens where they really are identical.
How long before the iOS app sees any benefit?
The first shared piece, such as API models or validation rules, can be used by iOS within the first few iterations. The benefit grows as more logic moves across and duplicated Swift code is deleted. Starting with the rules that change most often gives the quickest payback, since every later change is then made once.











