The mobile experimentation library existed as separate Java/Kotlin and Objective-C codebases, causing logic drift.

Drift broke data consistency across hundreds of active experiments, risking wrong product decisions.

The team solved it by: 👉 Move core experiment logic to a shared Kotlin module compiled for Android and iOS. 👉 Expose the module as a Gradle dependency on Android and an XCFramework via CocoaPods on iOS. 👉 Run the new KMP library alongside the legacy one, using experiment flags as kill switches.

The parts that matter: 1️⃣ Kotlin Multiplatform (KMP) - Compiles shared Kotlin code to JVM bytecode and native iOS binaries 2️⃣ XCFramework - Packages the compiled iOS binary for distribution through CocoaPods

After migration the iOS library became the single source of truth and startup times improved once the legacy code was removed.

During the parallel rollout the app download size grew by about 2.5 MB and iOS 90th-percentile startup time increased by 140 ms. The team accepted this temporary overhead to guarantee data integrity and a safe cut-over. Post-migration the performance gain from Kotlin coroutines offset the initial cost.

How do you balance temporary performance penalties against long-term consistency when consolidating cross-platform logic?