Kotlin mobile multiplatform library able to build in isolation as well as within android project

301 views Asked by At

I want to have a git submodule that is my kotlin multiplatform mobile code. Right now the problem that I'm having is that I can either get the library building in isolation, or as part of the Android project - but not both.

In my library's build.gradle.kts I have

plugins {
    kotlin("multiplatform") // version "1.4.10"
    id("com.android.library")
}
  1. With the multiplatform plugin version commented out, my android project can build fine
    but when running ./gradlew tasks for my library I get this error:

    What went wrong: Plugin [id: 'org.jetbrains.kotlin.multiplatform'] was not found in any of the following sources:
    Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    Plugin Repositories (plugin dependency must include a version number for this source)

  1. With the multiplatform plugin version specified, the library can build fine
    but when running ./gradlew tasks for my android project I get this error:

    What went wrong: Plugin [id: 'org.jetbrains.kotlin.multiplatform'] was not found in any of the following sources:
    Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    Plugin Repositories (plugin dependency must include a version number for this source)
    Error resolving plugin [id: 'org.jetbrains.kotlin.multiplatform', version: '1.4.10']
    Plugin request for plugin already on the classpath must not include a version

Any suggestions / examples for how to get it working for both? Thank you

0

There are 0 answers