My team has an Android app, developed over the past year, that's entirely written in Kotlin. We're interested in reaching a new user base to iPhone users.
One idea is to use Kotlin Multiplatform (KMM). This approach would allow us to reuse the existing business logic code from the Android app, eliminating the need to code from scratch.
I've begun a proof of concept for this as follows:
- Create a KMM shared module in a new KMM app repository. This KMM app repository will only for iOS build. We will still build the Android app using Android app repository.
- Export the shared module to a Maven registry.
- Import the Maven registry into the exiting Android app repository.
My question is that, can we do the other way around by create the a shared KMM module in the Android app and then export it to Maven. Then we import it in the KMM app repository. This way my team don’t have to switch over repository over and over again until they are ready to move the UI implementations.
I tried to add the “Kotlin Multiplatform Shared Module” in the Android app, but it cannot build. It says "Unresolved reference: libs".
See the step below.



Update 1:
I tried adding the libs.versions.toml in the gradle directory with the content below.
[versions] agp = "8.2.0" kotlin = "1.9.22" [plugins] androidLibrary = { id = "com.android.library", version.ref = "agp" } kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlinCocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" } The error becomes this
Error resolving plugin [id: 'org.jetbrains.kotlin.multiplatform', version: '1.9.22'] > The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.
Источник: https://stackoverflow.com/questions/781 ... o-maven-to