Kotlin Multiplatform, some of you might have heard this being thrown around at your work, or if you are a mobile app developer keen on following the latest news in the app development world. Kotlin, as a language is very mature now and gradually many companies and individuals are moving towards rewriting or implementing new modules in Kotlin. We have been seeing multiplatform app development from last few years using Cordova, ionic and ReactNative. Although, that required developers to learn a new language (JavaScript, Typescript etc…) altogether and leave behind their favorite native languages such as Java and Swift/Objective-C. But…
We saw how a Kotlin Multiplatform app can be setup to work seamlessly on Android and iOS in the earlier post. Now, let’s take a look at the possible errors that you may encounter along the way and how to resolve them. Bam!
Issue: 1
Now, that we have seen what Kotlin Multiplatform is and how we can setup the foundation for a multiplatform project. Let’s look at how it is done in Android and iOS with a sample app.
Using SharedModule from Android
Let’s add the SharedModule as a dependency to the main project. We can use the kotlin-multiplatform plugin directly in an Android project, instead of Kotlin-android plugin.
So, let’s patch the app/build.gradle file and include the below line into the dependencies { .. } block and perform a Gradle sync.
implementation project(‘:SharedModule’)
A passionate software engineer, primarily developing iOS apps. Open to all sorts of new cutting edge tech, and gadgets. Love to diversify interests!