# Migrating a Real Android App to Kotlin Multiplatform 2/4 -- What Moved for Free, and What Hurt

DevFeed: [Migrating a Real Android App to Kotlin Multiplatform 2/4 -- What Moved for Free, and What Hurt](<https://devfeed.tech/articles/migrating-a-real-android-app-to-kotlin-multiplatform-2-4-what-moved-for-free-and-what-hurt-113141.md>)

Original publisher: [Read original article](<https://proandroiddev.com/migrating-a-real-android-app-to-kotlin-multiplatform-2-4-what-moved-for-free-and-what-hurt-7ec973002f01?source=rss----c72404660798---4>)

Author: Daniel Voko

Published: 2026-11-02T14:51:13Z

Content type: article

Language: en

Sources: [ProAndroidDev](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [koin](<https://devfeed.tech/topics/koin.md>), [Ktor](<https://devfeed.tech/topics/ktor.md>), [sqldelight](<https://devfeed.tech/topics/sqldelight.md>), [Android](<https://devfeed.tech/topics/android.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [apis](<https://devfeed.tech/tags/apis.md>), [app](<https://devfeed.tech/tags/app.md>), [code](<https://devfeed.tech/tags/code.md>), [compose-multiplatform](<https://devfeed.tech/tags/compose-multiplatform.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [context](<https://devfeed.tech/tags/context.md>), [coupling](<https://devfeed.tech/tags/coupling.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [di](<https://devfeed.tech/tags/di.md>), [files](<https://devfeed.tech/tags/files.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [init](<https://devfeed.tech/tags/init.md>), [interface](<https://devfeed.tech/tags/interface.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [koin](<https://devfeed.tech/tags/koin.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>)

## AI overview

The author reports that roughly 84% of the app's Kotlin code moved to commonMain, but migration effort depended more on the app's platform coupling than on library support. Ktor's client configuration and request logic moved unchanged; SQLDelight's schema and queries were already platform agnostic, though its web WebWorkerDriver stores data only in memory. Koin modules bind platform implementations to shared interfaces when construction needs platform dependencies; this avoids some expect/actual constraints but makes missing bindings runtime failures. The excerpt recommends building a second target in CI early because Android builds can miss Android-only dependencies leaking into shared code. Replacing pervasive java.time usage was the hardest work: kotlinx-datetime helped, while locale-aware date formatting needed custom implementations using java.time on Android, Intl.DateTimeFormat on wasm, and NSDate on iOS. File uploads use a lazy, repeatable byte-source boundary; Android and iOS can stream, while the web implementation buffers chunks because browser reads are asynchronous and kotlinx-io's RawSource is synchronous. Multiplatform Settings with kotlinx.serialization handles key-

## Source excerpt

Migrating a Real Android App to Kotlin Multiplatform 2/4 -- What Moved for Free, and What HurtPart 2: What Moved for Free, and What Hurt In Part 1 I described the foundations: a modular Android codebase with Ktor, Koin and SQLDelight already in place, and a rule that the Android app must stay shippable after every step. The result is that around 84% of the Kotlin code now lives in commonMain. What that number hides is how unevenly the work was distributed. Some layers moved almost mechanically, in an afternoon, with a plugin swap and a few imports. Others took weeks and touched code I hadn't looked at in years. The pattern turned out to be simple, and in hindsight obvious: multiplatform support in your libraries matters far less than how tightly your own code is coupled to platform APIs. A library either supports KMP or it doesn't, and you find out in minutes. Your own platform coupling is spread across hundreds of files and you find out gradually, for weeks. What moved for freeKoin Dependency injection is the piece I'd underrate if I were writing this list from memory, and it deserves more credit than that. Koin ended up being the mechanism that keeps platform code out of shared code. Instead of reaching for expect / actual every time a component needs a platform implementation, the shared code depends on an interface, and each platform contributes a module that binds it: https://medium.com/media/a9ac7c95779230353cc1e3f0943e48b7/href expect/actual works well for small, self-contained things: a platform name, a formatter, a UUID generator. It gets awkward as soon as a platform implementation needs its own dependencies. The declaration in commonMain fixes the constructor signature for every target, so an Android implementation that needs a Context has to get it some other way, usually through an init step the platform has to remember to call. With a DI module, shared code depends on an interface and nothing else. Each platform binds its own implementation, with whatev