Tim Ortel
01/07/2022, 7:35 PMFailed to apply plugin class 'org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin'.
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:173)
at org.gradle.api.internal.plugins.DefaultPluginManager.addImperativePlugin(DefaultPluginManager.java:89)
at org.gradle.api.internal.plugins.DefaultPluginManager.addImperativePlugin(DefaultPluginManager.java:96)
at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:77)
at org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin$Companion.apply(NodeJsRootPlugin.kt:73)
...
Caused by: java.lang.IllegalStateException: The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
If the parent project does not need the plugin, add 'apply false' to the plugin line.
My settings.gradle.kts looks like this:
pluginManagement {
repositories {
...
}
val kotlinVersion: String by settings
val agpVersion: String by settings
val composeVersion: String by settings
plugins {
kotlin("jvm") version kotlinVersion apply false
kotlin("multiplatform") version kotlinVersion apply false
kotlin("android") version kotlinVersion apply false
kotlin("plugin.serialization") version kotlinVersion apply false
kotlin("plugin.parcelize") version kotlinVersion apply false
id("com.android.application") version agpVersion apply false
id("com.android.library") version agpVersion apply false
id("org.jetbrains.compose") version composeVersion apply false
}
When I apply js(IR) { browser() } in 2 submodules, i get this error. What could be the problem?