Kotlin Multiplatform Mobile from JetBrains Takes on Flutter
A new beta mobile SDK will allow Kotlin developers to deploy mobile apps to iOS and Android with a native user interface, from a single codebase.
JetBrains released its Kotlin Multiplatform Mobile in beta Monday. Beta means JetBrains has stabilized the features and it can be used in production, said Ekaterina Petrova, product marketing manager.
“The need for fast product delivery led us to experiment with a multiplatform architecture. Now we’re taking this one step further by using Kotlin Multiplatform to write platform-agnostic business logic once in Kotlin and compiling to a Kotlin library for Android and a native Universal Framework for iOS via Kotlin/Native,” Netflix software engineers David Henry (now at Meta) and Hemel Yahya shared back in October 2020.
Single Codebase for Application Logic
Writing the business logic piece once is a key differentiator for the Kotlin Mobile Multiplatform, which offers a single codebase for the application logic, allowing developers to maintain a single codebase for networking, data storage, analytics, and the other logic of their Android and iOS apps.
“Kotlin Multiplatform approaches cross-platform mobile development differently from some well-known technologies in the space,” Henry and Yahya stated. “Where other technologies abstract away or completely replace platform-specific app development, Kotlin Multiplatform is complementary to existing platform-specific technologies and is geared towards replacing platform-agnostic business logic.”
Sharing business logic and using a common code for the business logic means that users can do their interfaces natively, said Pamela Hill, developer advocate for JetBrains.
“What Kotlin Multiplatform for Mobile brings to the table is that it has to do more with sharing common code between platforms, and then doing the rest natively rather than doing everything in a particular language with a particular framework, like the other multiplatform technologies do,” Hill said. “What our customers really like is having that common code business logic and then doing their user interfaces natively so that it has their beautiful iOS, Android, Android, native-looking user interfaces.”
The platform supports native and cross-platform development benefits so that developers can “share code for logic elements that often fall out of sync, while keeping the advantages of native programming, including great app performance and full access to the Android and iOS SDKs,” the company noted in its release.
Kotlin can be used for cross-platform and native apps, so developers don’t have to write in other languages for the mobile apps. It also uses the tooling and ecosystem of Kotlin and provides tooling for cross-platform mobile development in Android Studio, the company stated. It can be used to port existing apps that are already written for Android or iOS to the competing mobile platform, Hill said.
Mobile libraries such as Ktor, SQLDelight, Apollo, and Koin have already adopted Kotlin Multiplatform, JetBrains stated. The beta also updated the memory management approach to provide consistent experience between Android and iOS targets. Kotlin syntax follows the same concepts used for iOS development and is easy for iOS developers to learn, according to JetBrains, which also notes more than 60% of Android developers already use the open source statically typed programming language.
Kotlin versus Flutter
Kotlin Multiplatform Mobile competes with Google’s Flutter, which also supports multiplatform deployment. A differentiator is that Flutter is used to develop the whole app, whereas Kotlin can be adopted incrementally, Hill said. Another difference, at least according to Hill, is that Flutter has a material design for user interface that “never looks completely native, especially on iOS,” she said.
“Whereas on Multiplatform Mobile, you can use your Swift UI on iOS and you can use your own your Jetpack Compose or your Vue system on Android and have perfectly native-looking user interfaces,” she said. “The adoption is really incremental and as you choose, rather than being forced into an all-or-nothing approach.”
However, Kotlin Multiplatform may have an uphill battle convincing developers: Kotlin Multiplatform has 2% of the cross-platform mobile market as of 2021, compared to 42% for Flutter, according to Statistica’s most recent data. Flutter has a great deal going for it as well, as The New Stack has previously enumerated. Harikrishna Kundariya, the CEO & founder at eSparkBiz Technologies, offered a more positive view of Flutter’s capabilities.
“Thanks to its reliance on the Dart programming language, Flutter executes code swiftly,” Kundariva wrote. “It greatly helps in advancing the overall performance by making it appear, work, and feel like an exact native app.”
Kundariya also noted that the UI/UX offers a clean visual and enriching experience for developers, adding that Flutter’s architecture “ensures customizing the programmed apps into their respective operating systems in a swift way.”
Still, Kotlin and Java are the primary languages used to deploy Android apps — even Google, which created Flutter, uses Kotlin, reporting that more than 70 of its apps, including Maps, Play, Drive and Messages, are built using the programming language.