Idéematic
EN
Discuss your projectContact usContact
Mobile development

Everything you need to know about Kotlin Multiplatform Mobile (KMM)

IdéematicUpdated on 7 min read
Everything you need to know about Kotlin Multiplatform Mobile (KMM)
Contents
  1. What is Kotlin Multiplatform Mobile (KMM)?
  2. How do you build and launch a mobile app with KMM?
  3. What are the advantages of KMM?
  4. What are the drawbacks of KMM?
  5. Which companies use KMM to develop their apps?
  6. Conclusion
  7. Frequently asked questions

According to a study by Bocasay (in French), mobile apps account for 60% of the development market, compared with 38% for web applications. Beyond progressive web apps (PWAs), no-code development and AI integration, another trend is emerging. Cross-platform frameworks are increasingly popular because they make it possible to deploy a mobile app on Android and iOS from a single codebase. These powerful, flexible solutions could reach revenue of $546.7 billion by 2033.

At Idéematic, we notably develop mobile apps with React Native. Since 2020, an innovative solution has made it possible to share business logic while keeping native performance: Kotlin Multiplatform Mobile (KMM). What is this tool, and how does it work?

1. What is Kotlin Multiplatform Mobile (KMM)?

Kotlin Multiplatform Mobile (KMM) is an SDK (software development kit) that is part of Kotlin Multiplatform (KMP), JetBrains’ framework. It lets you build mobile apps with code shared between iOS and Android.

Unlike Flutter or React Native, KMM doesn’t rely on a third-party runtime. The Kotlin language is compiled into native or intermediate code depending on the platform (JVM bytecode for Android, LLVM native code for iOS). As a result, developers can share several parts of the business logic, such as algorithms, network calls and data handlers. To build these cross-platform mobile apps, knowledge of Swift is recommended for the iOS side (Inside App, in French).

This interoperability provides access to many libraries and frameworks, such as SwiftUI and UIKit (for iOS) or Jetpack Compose (for Android). With a JavaScript engine such as Nashorn, you can work with JavaScript libraries like React (ValueCoders). The relationship between modules and code works both ways (Kotlin documentation):

  • A Swift library is brought into Kotlin code by exporting its API (application programming interface), using the @objc attribute.
  • Kotlin modules, once compiled into frameworks, are integrated into Swift or Objective-C code.

2. How do you build and launch a mobile app with KMM?

The architecture of a KMM mobile project

To work across mobile operating systems, a Kotlin Multiplatform Mobile project contains three specific parts (Axopen, in French):

  • The common part contains the Kotlin code shared by all platforms. Its shared folder contains the code for each operating system (androidMain and iosMain) and the shared code (commonMain). The app’s core code is written in this last part.
  • The Android part contains the source code specific to that system, named androidApp. The user interface is built in the Android Studio integrated development environment (IDE).
  • The iOS part contains the source code for Apple devices, named iosApp. The developer builds the user interface in the Xcode IDE. Like the Android part, the iOS part is linked to the “shared” module to access the shared business code.

Platform-specific implementations are handled with the expect and actual keywords. The first declares an entity (function, class, property) and defines a common interface in the shared module. The second provides the entity’s implementation on the corresponding platform.

// commonMain

expect fun platformName(): String

// androidMain

actual fun platformName(): String = "Android"

// iosMain

actual fun platformName(): String = "iOS"

Developing a mobile app with KMM

The first step is to set up your development environment. Make sure you have the following tools (JetBrains):

  • Android Studio or Xcode to build the apps.
  • The Java Development Kit (JDK), for the Java software libraries.
  • The Kotlin Multiplatform plugin for Android Studio. Its latest version, released on 6 December 2024, supports K2 mode, a compiler that improves code analysis and stability.
  • The KDoctor tool if you work on iOS, to analyse and fix set-up problems.

When the environment is ready, you can create a new project. In Android Studio, you select the “KMM Application” template and fill in the fields. Once the app is ready, you choose your target platform from the list of Run Configurations, then confirm with the Run button. Thanks to this architecture, you can launch the iOS simulator from Android Studio.

3. What are the advantages of KMM?

Thanks to code sharing, development time for an app in Kotlin is shorter than in Flutter, for example (GeeksforGeeks). The business logic rests on a common architecture and can be reused across several platforms, as can algorithms and data models. With such reductions in time, and therefore cost, Kotlin is an excellent choice for small businesses and start-ups.

Because the code is compiled to machine code, development requires less effort in learning programming languages. For example, you don’t need to master JavaScript or Swift to develop your app, since Kotlin already integrates with their frameworks.

The user interface (UI) remains native whatever the platform. Rendering is more efficient, and native features such as Bluetooth or the phone’s camera keep their performance on iOS and Android.

With performance comparable to truly native apps, this optimises your app’s user experience (UX). For example, the Kotlin/Native compiler can rebuild the iOS framework in the data-storage sample project in 4.5 seconds (JetBrains blog).

4. What are the drawbacks of KMM?

Kotlin Multiplatform Mobile was released in 2020. Despite updates, such as more libraries and new sample projects, its ecosystem remains limited compared with Flutter. For example, only a few Java libraries are compatible with KMM. JetBrains’ developers make up for this with a GitHub repository (Atipik, in French).

Although everything is designed to save time, a KMM project is more complex on iOS than on Android. This complexity comes from juggling development environments and programming languages (Swift and Kotlin). Direct export between Kotlin and Swift is not always supported, which can complicate iOS development.

That is why it is important to build a team of Android and iOS developers to carry the project through on both platforms. It follows that Kotlin Multiplatform is not cost-effective for small apps with minimal code (Ailleron).

Summary · KMM in practice
Strengths and limitations of Kotlin Multiplatform Mobile
AspectWhat KMM makes possibleWatch out for
Shared codeBusiness logic, algorithms, network calls and data models shared between iOS and AndroidPlatform-specific code is handled with expect and actual
InterfaceA native interface on each platformBuilt separately in Android Studio and in Xcode
PerformanceClose to a native app, including Bluetooth and the camera–
EcosystemAccess to SwiftUI, UIKit and Jetpack ComposeFewer libraries than Flutter, few compatible Java libraries
TeamFewer languages to masterAndroid and iOS skills are still needed
Cost-effectivenessShorter timelines and lower costs on large projectsPoor value for a small app with minimal code

5. Which companies use KMM to develop their apps?

Some companies have developed their mobile apps with KMM and achieved significant results. Quizlet, Fastwork, Netflix… according to the JetBrains blog, these big brands improved the performance of their mobile apps and, with it, their productivity. For McDonald’s, sharing complex code across platforms made it possible to handle 6.5 million mobile purchases (JetBrains case studies). Google even recommends KMP in general for cross-platform apps.

6. Conclusion

Kotlin Multiplatform Mobile is a promising tool for developing cross-platform mobile apps. It combines the advantages of code sharing with native performance, while reducing development costs and timelines. Although some progress remains to be made, particularly on iOS, large companies have already adopted it successfully. Its developer, JetBrains, has an effective roadmap, including the new K2 compiler and better iOS support.

Frequently asked questions

What is KMM?

KMM, short for Kotlin Multiplatform Mobile, is a JetBrains development kit for building mobile apps with code shared between iOS and Android, written in Kotlin.

What is the difference between KMM and KMP?

KMM is the mobile part of Kotlin Multiplatform (KMP), JetBrains’ broader framework for sharing code across platforms.

What is the difference between KMM and Flutter or React Native?

KMM doesn’t rely on a third-party runtime: Kotlin code is compiled to bytecode for Android and to native code for iOS. Business logic is shared and the interface stays native on each platform.

Which tools do you need to develop with KMM?

Android Studio or Xcode, the Java Development Kit (JDK), the Kotlin Multiplatform plugin for Android Studio and, for iOS, the KDoctor tool that detects configuration problems.

Is KMM suitable for every project?

No: it is mainly worthwhile for large projects. For a small app with minimal code it offers poor value, and development remains more complex on iOS than on Android.

Which companies use KMM?

According to JetBrains, companies such as Quizlet, Fastwork, Netflix and McDonald’s use it to share the code of their mobile apps.

Further reading

In the same category

All articles

What about your future mobile app?

At Idéematic, we work with several technologies to build the most flexible and scalable mobile app possible. Our custom products meet your needs and requirements while ranking well in the app stores.

Get in touch with IdéematicContact us