• Home / Android / How Kotlin Multiplatform Mobile Works

How Kotlin Multiplatform Mobile Works

  • April 19, 2021

Kotlin Multiplatform Mobile (KMM) is an SDK that allows you to use the same business logic code in both iOS and Android applications. Today KMM goes Alpha, and you can start sharing business logic in your mobile apps with it right away. It includes the new KMM Plugin for Android Studio, which allows you to write, run, test, and debug shared code in the same IDE. Join great teams such as VMWare, Autodesk, and Yandex who are sharing code in their mobile apps using Kotlin. Reusable code between mobile platforms is can cut workloads in half, and the amount of custom functionality has never been so great and implementation has never been so easy!


What is Kotlin Multiplatform Mobile?


Kotlin Multiplatform Mobile (KMM) is an SDK for cross-platform mobile development provided by JetBrains. It uses the multiplatform capabilities of Kotlin and includes various tools and features designed to make the end-to-end experience of building mobile cross-platform applications as enjoyable and efficient as possible.


The Android and iOS versions of an application often have a lot in common, but they can also differ significantly – especially in terms of their UI – from subtle variations in scrolling behavior to completely divergent navigation logic. At the same time, the application’s business logic, including such features as data management, analytics, and authentication, is often identical. That’s why it is natural to share some parts of an application across platforms while keeping other parts managed and coded completely separate.


With KMM, you add the benefits of cross-applicability and retain the benefits of native programming. With KMM your team can use a single codebase for the business logic of iOS and Android apps and write platform-specific code only where it’s necessary, to implement a native UI or when working with platform-specific APIs.





KMM is seamlessly integrated with your mobile project. Shared code, written in Kotlin, is compiled to JVM bytecode with Kotlin/JVM and to native binaries with Kotlin/Native, so you can use your KMM business-logic modules just like any other regular mobile library.


Sharing Kotlin code between mobile platforms has already saved a lot of time and effort for many companies. Here are some inspiring stories:


  • Quizlet migrated their business logic from a shared JavaScript approach to KMM and drastically improved the performance of both their Android and iOS applications.
  • Fastwork introduced KMM for the domain and data layers of their application to share business logic and API service between mobile platforms, significantly boosting their team’s productivity.
  • Yandex.Disk started out by experimenting with the integration of a small feature, and when the experiment proved successful, they implemented their whole data synchronization logic in KMM.


Enjoy creating mobile apps with KMM


KMM is still quite new to the mobile development world, but we believe that it is a true game-changer. That’s why Google has allocated a separate team within their Kotlin development organization to push KMM forward and provide the best developer experience for the creation of cross-platform mobile applications with Kotlin.


Work in a familiar environment


With the new KMM plugin, you can write, run, test, and debug shared code in Android Studio, without switching to other IDEs. To install it, select Preferences | Plugins, search for the Kotlin Multiplatform Mobile plugin in Marketplace, and click the Install button.


Configure a new application in a few clicks


With the New Kotlin Multiplatform Mobile Project wizard, you can create a ready-to-run mobile application project with a shared codebase in just a few clicks. To see how it works on both platforms, just select the run configuration you need and click the Run button.





The generated project will contain examples of how to connect to platform-specific API and basic test coverage. You can use this wizard to explore the basic features of KMM or as a scaffolding tool for your new KMM production application.


Introduce KMM to your existing project in one step


You also can start your KMM journey right in your current project: the shared Kotlin code can be easily integrated into your existing code just like any other regular dependency. The New Kotlin Multiplatform Mobile Module wizard will help you add a new KMM module to your project, so you can use the code you’ve already written in Kotlin and refactor it to make it compatible with iOS.


Work with both platforms within one IDE


You no longer need to switch IDEs and have Xcode running to check that your code works correctly on both mobile platforms. With the new plugin, you get integration with your iOS device and simulator directly in Android Studio. This gives you the following capabilities:


  • Run and debug the iOS application on the simulator or a device with the predefined run configuration.
  • Run and debug common and iOS specific tests on the iOS simulator by simply clicking the gutter icon on a test class or method.


For both the application and tests you can set breakpoints and debug your code on iOS.




Integrate with the iOS ecosystem without any overhead


As mentioned above, KMM is seamlessly integrated with your mobile project. For Android, you can use Kotlin for every part of your project. At the same time, KMM provides tight integration with the iOS development process, because of Kotlin/Native’s interoperability with Objective-C/Swift, the integration with the CocoaPods dependency manager, and the ability to use platform-specific APIs with the expect/actual pattern.


Enjoy working with Kotlin from Swift code with Kotlin/Native


Kotlin/Native provides bidirectional interoperability with Objective-C/Swift. Kotlin modules can be fully used in Swift/Objective-C. You can use Objective-C frameworks and libraries in Kotlin code, as well as Swift libraries if their API is exported to Objective-C with @objc.

Easily manage iOS dependencies


Kotlin/Native provides integration with the CocoaPods dependency manager. You can add dependencies on Pod libraries stored in the CocoaPods repository or locally, and you can also use multiplatform projects with native targets as a CocoaPods dependency (Kotlin Pod). Manage Pod dependencies directly in Android Studio and enjoy full coding support, including highlighting and completion.



Learn how to create better multiplatform mobile apps on the new Developer Portal


The new KMM Developer Portal is designed to make your journey more comfortable and productive, from your very first experience with KMM all the way through to using it in production.

The documentation section is your trusted resource when you are working with KMM. You will find content for all levels of expertise, from tutorials to get you started to more advanced development topics. It contains useful information about common tasks, like organizing networking and data storage layers and even organizing the development process around KMM.


Looking for new ideas about the benefits of using KMM in your application? Learn from the first-hand experience of a variety of teams who are already using KMM in their products in the case studies section.


Share your feedback


This release is just the beginning of the journey, but we need your help along the way. We look forward to all your feedback, both bad and good. Become an inspiration for others by sharing your stories of using Kotlin Multiplatform Mobile, and please share any ideas you have about how we can improve KMM.