Category: Blog, Business, Development, Fundamentals, Kotlin

Kotlin Multiplatform: A Smart Choice for Cross-platform Development?

Explore the potential of Kotlin Multiplatform for your next digital product. Discover how it bridges native and cross-platform development, cutting costs without cutting corners.

What is Kotlin Multiplatform?

In the IT industry, there are no silver bullets. When we create applications, we need to be smart and choose the best tools for our specific needs and current situation. When it comes to mobile app development, you’ve probably heard of this difficult decision:

Build natively or cross-platform?

At first glance, it might seem simple: cross-platform projects are cheap, while native ones are expensive. But the real world is not so black and white. On the one hand, there are use cases where technologies like Flutter or React Native are simply not enough due to their own limitations. On the other hand, many companies in the market already have successful native products. They don’t want to rewrite them to a completely different technology, but they are still looking for code sharing options to simplify development and make it more effective.

Could it be possible to take the best of both worlds?

Imagine you create applications for Android and iOS with native technologies like you normally would. At the same time, you reduce development costs by about 40% by sharing the same code between these two native platforms. And all of this happens without introducing any new framework or programming language. Developers just use the tools they already know very well. Sounds interesting? So take a seat and let me tell you a bit more about Kotlin Multiplatform.

What is Kotlin Multiplatform?

More and more people in the mobile development world start to ask this question, as the technology is growing in popularity. According to the latest The State of Kotlin Multiplatform Survey , 60% of developers already use or have tried Kotlin Multiplatform in production and 45% have participated in more than one Kotlin Multiplatform project.

Kotlin itself is a modern programming language developed by JetBrains, creators of many highest-class programming tools on the market. Currently, we mainly associate Kotlin with the Android platform, where it became very popular among programmers. According to official statistics, 95% of the top 1,000 Android apps are built in Kotlin.

However, despite its popularity in the Android world, it was not designed to be an Android specific technology. The idea behind Kotlin was to create a universal language that would work with other programming languages and could therefore be used to build applications for different platforms, not only Android.

So, Kotlin is a multiplatform language by design. But the question remains the same: what is this KMP that everyone is talking about? I’m rushing with the response. 

KMP (Kotlin Multiplatform) is nothing more than just a set of official tools for developers that organize and simplify the process of using the Kotlin language on various platforms simultaneously.

In a KMP project, most of the code can be implemented just once in Kotlin and then easily reused in various native applications.

Thanks to this shared code, we can build full-fledged and uncompromising native applications much faster and with less effort. 

What platforms does Kotlin Multiplatform support?

We can use Kotlin on Android thanks to its interoperability with Java, but other languages are officially supported, too. Currently, three of them have the most mature support, but JetBrains is constantly working to expand the list.

  • Java: That’s how Kotlin works on Android devices, but we can likewise use it in Desktop or Server applications.
  • JavaScript: Support for this language enables us to use Kotlin in Web applications, including both frontend and backend ones.
  • C / Objective-C: This way we are getting access to all the Linux based platforms and Apple operating systems like iOS devices, iPadOS, macOS, tvOS and watchOS. And because Objective-C works with Swift, we can use Kotlin in Swift projects as well.
What platforms are supported by Kotlin Multiplatform?

Read also: Convert Your Native Project to Kotlin Multiplatform: Why, When and How

How does Kotlin Multiplatform work?

The code we write in Kotlin is not the same code that runs on the target platforms. It is always translated into another language by a special program that we call the Kotlin compiler. As we said before, Kotlin supports three major languages, so we accordingly have three different compilers:

  • Kotlin/JVM – translates Kotlin into Java
  • Kotlin/JS – translates Kotlin into JavaScript
  • Kotlin/Native – translates Kotlin into C or Objective-C

KMP works thanks to these compilers. They are used by developers to build the final application. The entire translation process takes place only once before the app is deployed to the store, website, server etc. This means that, in practice, we don’t ship any Kotlin code with our application. The actual product contains only the native code, just like any other app built without KMP.

Is Kotlin Multiplatform stable?

The Kotlin language itself is stable and widely used since 2016. The KMP toolset remained in Beta for a couple of years and was officially moved to stable in November 2023. It is now a complete Production-Ready solution. The only thing which is currently in Alpha is Compose Multiplatform, which enables us to also share UI components with other platforms.

KMP vs KMM: What’s the difference?

When you look around the Internet for information about KMP you may notice that people sometimes use a different name: KMM, which is short for Kotlin Multiplatform Mobile. All you need to know is that the name KMM is no longer in use and it is no different from the KMP itself.

It was originally used for marketing purposes to highlight the value of using Kotlin to share the code across Android and iOS mobile platforms. In July 2023, this name was officially abandoned. Now KMP is the preferred term when referring to this technology.

How does Kotlin Multiplatform differ from other cross-platform solutions?

When I first talk to people about Kotlin Multiplatform technology, they usually ask me the same question:

Why do we need the next multiplatform solution? After all, we already have Flutter and Reactive Native, which are well-known and battle-tested, right?

And this question is completely justified, as we expect the next advanced, single codebase framework, similar to those we already know. However, KMP went its own way that is unlike anything before.

Everyone wants to replace native applications

Over the years, many companies and engineers have tried to find alternative ways to build mobile applications. We have seen Progressive Web Apps, then hybrid apps built with Cordova or Ionic. Nowadays, Flutter and React Native take the lead.

They all represent a slightly different approach, but they also have one thing in common – they all want to replace native apps and native programming. These solutions introduce new languages, new architectures, their own tools and many dedicated open source libraries – simply entire ecosystems. This means that they also require new skills, so as a result, we have React Native and Flutter developers.

KMP aims to improve native applications

The way Kotlin Multiplatform works is a completely different story. First of all, it doesn’t introduce any new framework or programming language. Developers use the same Kotlin that they already know very well.

Then, thanks to the Kotlin compilers, common code is translated into platform specific code for Android, iOS, Web etc. And finally, we just use this code in native applications. Simple as that!

High flexibility, low risk

Unlike other solutions, KMP doesn’t move us to a separate ecosystem. We still build regular native applications and decide what parts of the code we want to share across multiple platforms.

If some functionality can’t be implemented in the common code, we just implement it natively. If we want to use some system API or native tool, we just do it. And, if at any point, you decide that this technology is not the right choice for your project, there’s always a way back. We can use Kotlin only for Android and develop the iOS app independently. This high flexibility makes KMP less risky compared to other solutions.

When should you choose KMP?

The main disadvantage of native development is its high cost, as we have to build separate Android and iOS applications. KMP helps us reduce this effort by approximately 40% while keeping all the advantages of native technologies.

Kotlin Multiplatform makes app development 40% faster

JetBrains, creators of Kotlin and KMP, claim that it is suitable for all kinds of projects. This is a very bold declaration, but after 3 years of working with Kotlin on various multiplatform projects, I definitely agree with it.

  • If you are planning to build a mobile app, you no longer have to choose between native and cross-platform. With KMP, you can have an uncompromising native application with much less effort.
  • If you have existing native apps, KMP can help you reduce the effort needed to deliver new features, simplify maintenance and improve consistency and cooperation across different platforms. You don’t need to rewrite entire apps to a completely new technology. Just add KMP and start a gradual migration (see how to do this).
  • If you want to expand to a new platform and currently only have an Android app, by reusing existing Kotlin code, you can ship an iOS app much faster. Just take the existing logic, write a native UI and you’re ready to go.

When should you choose Kotlin Multiplatform over Flutter or React Native?

There is no doubt that KMP can significantly reduce the effort needed to develop and maintain native applications for multiple platforms. But what if we consider using other solutions instead?

At Droids on Roids, we have great experience in building amazing mobile applications with cross-platform frameworks. But, as I said at the beginning of this article, there are no silver bullets in the IT world, and Flutter or React Native are no exceptions. Because KMP works like a regular native application, implementing some features and solving specific problems may be easier there than in other technologies. It may be that building two apps with KMP is easier than building one with Flutter or React Native.

Augmented Reality / Internet of Things 

In these areas, we make extensive use of the hardware functionalities of mobile devices. Access to the camera, sensors, Bluetooth or NFC is done via the platform specific APIs. In the case of Flutter or React Native, we have to rely on open source libraries or build our own bridges, which can complicate development. KMP can use all the hardware directly, as it works like a regular native application.

3rd party integrations and SDKs

Companies often rely on third-party vendors for some software solutions for their mobile applications. Most often, these are analytical and marketing tools, but your product may also require more advanced solutions. Document scanning, image recognition, payments, credit scoring or biometric authentication are just a few examples. Android and iOS SDKs are the industry standard, but Flutter or React Native equivalents are not as common. With KMP, you don’t have to worry about this because we can use all native tools directly.

Wear / Auto / TV 

Android and Apple platforms are no longer just about smartphones. Smartwatches, Smart TV and Smart Cars are becoming more and more important on the market. Code implemented in Kotlin can be shared on these platforms, while Flutter and React Native don’t have official support.

Large apps and strong competition 

Native technologies are known for offering the best possible user experience and highest performance, which really makes a difference when the competition in the market is fierce. With KMP, we can leverage the native UI, shared logic approach to offer users an uncompromising product with platform-specific features and customizability. Additionally, as the product becomes more complex, it must remain easy to maintain and develop. Kotlin has been proven to be an excellent choice for large and complex codebases. It has a large community and offers a wide range of modern features not found in other languages such as Dart, JavaScript or TypeScript.

Key benefits of Kotlin Multiplatform development

I hope it’s more clear now when you should consider KMP as a good choice for your next or existing project. So, let’s quickly summarize the most important benefits you can gain.

  • Faster and simpler native development: Thanks to shared code built in Kotlin, we can significantly accelerate the development of new or existing native applications. In our experience, the actual gain is around 40%.
  • No need to introduce a new language or framework: Developers use the same Kotlin language they already know very well from the Android platform. The team can start using KMP very quickly without having to learn many new things.
  • You choose what you share: KMP does not impose rigid frameworks and restrictions on you. You can choose if you want to share only some critical part of your app, the entire business logic, or, thanks to Compose Multiplatform, even some UI elements as a common Design System.
  • Direct access to native features and tools: Unlike other multi-platform solutions, KMP enables us to directly use all platform specific dependencies. There is no need for open-source alternatives or custom bridges.
  • Smooth integration with existing projects: If you already have native apps, you don’t need to rewrite them. KMP enables you to reuse existing Kotlin code, and the entire process can be implemented gradually.
  • Less risky than other solutions: KMP is the only tool which can be added to your project at any stage and can be always removed. You just move back to having two fully independent native applications without any common code.

Top apps made with Kotlin Multiplatform

The era of KMP has already begun and many companies around the world have adopted it as their code sharing solution. Some of them had previously tried other alternatives and ultimately decided to stick with Kotlin, for its flexibility, simplicity, and unlimited access to all the native features. And these are not third-league players, but well-known brands with millions of users.

what popular apps are made with Kotlin Multiplatform
  • Forbes Magazine (iOS, Android) – One of the most famous magazines in the world uses KMP to offer their users custom, platform specific features while still sharing over 80% of their business logic across Android and iOS applications.
  • Netflix (iOS, Android) – The world’s largest streaming platform uses KMP to optimize product reliability, offer consistent offline support and deliver key features faster to its customers.
  • McDonald’s (iOS, Android) – Everyone knows McDonald’s, but not everyone knows that their mobile app was built using KMP. It eliminates the need for code redundancy and makes it easier to operate in hundreds of different markets around the world.
  • 9Gag (iOS, Android) – We all love memes and funny videos. And the creators of this well-known meme app love code sharing solutions. After trying both Flutter and React Native, they adopted KMP with very positive results.
  • Cash App (iOS, Android) – The company behind the #1 financial app in the United States has put a lot of effort into adopting KMP. Not only do they successfully use it in their main product, but they also create many tools and multiplatform libraries widely used by the community.
  • Quizlet (iOS, Android) – One of the most popular educational applications has learned to use Kotlin effectively, not only on mobile platforms but also on the web. They abandoned their previous shared JavaScript code and moved to Kotlin, which greatly improved performance and user experience.

Kotlin Multiplatform development with Droids On Roids

Each mobile application is unique in its own way. Each one brings different challenges and new ideas for providing value to its users. To build great apps, you need to be smart, and we at Droids On Roids are here to help you make smart decisions.

We have always seen great value in cross-platform technologies and have built many successful products using them. At the same time, we know their limitations very well and ,thanks to our extensive experience in native development, we can advise when it will be a better choice for your business.

Kotlin Multiplatform bridges the gap between these two extreme approaches, getting the best of both worlds. Our Android and iOS experts see this as a great way to build native apps more efficiently, and our experience shows that we are able to reduce the required effort by approximately 40%.

Kotlin Multiplatform Services

Regardless of whether you are planning to build a new product or you have an existing one that you would like to improve and develop, we are ready to help you find the right path to success. We build complete multiplatform projects from scratch, implement KMP in existing codebases, and educate other developers on how to work with this technology to achieve the best possible results. 

If you want to talk about your idea for a digital product, reach out to us and schedule a free consultation. We’d be happy to advise on the best technology for your project.

My final thoughts on KMP

It’s been a while since Kotlin and KMP entered the IT world. During this time, many companies around the world have seen how beneficial this technology can be for their products. Today I have no doubt that KMP will stay with us for a long time. The new path it has chosen offers us great flexibility and low risk, resulting in a solution that can finally take native development to the next level.

Since we don’t need to introduce any new framework or programming language, it is very easy to onboard Android and iOS devs to KMP. Since we rely on the same Kotlin language, we can essentially reuse a lot of the existing Kotlin code we already have in Android apps. As we continue to build native applications, we can fully leverage the potential of native UI, tools, SDKs, and system APIs.

And if you’re wondering if this technology will be abandoned or phased out anytime soon, don’t worry. As we wrote in this article, KMP is not really some new, niche solution. The ability to work across platforms is at the core of the Kotlin language itself. This flagship product of JetBrains has already been widely adopted in the market and highly appreciated by developers.

About the authors

Marcin Piekielny

Marcin Piekielny

Android Team Leader

Android Team Leader and Android Developer with 7 years of experience. He is a great enthusiast of the Kotlin language and its multiplatform use. Passionate about clean software architecture, cutting-edge technologies and building products that are both valuable to business and enjoyable to work for the team. Privately, a fan of video games, cooking and maintaining a healthy lifestyle.