The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
What exact kotlin plugin are we talking about ? My root project has modules using
org.jetbrains.kotlin.android
and others using plain
org.jetbrains.kotlin.jvm
. Can they/Should they both be applied in the root build.gradle.kts ?
g
gildor
08/24/2019, 1:14 PM
You cannot apply both of them, because Android plugin doesn't work Java plugin. But this problem is not about application of the plugin, but about plugin classpath, you apply plugin with version to 2 different subprojects using plugins DSL. To solve this issue add plugins to root build Gradle but do not apply them, set apply false
Also, this is not specific to Kotlin, this is Gradle warning
gildor
08/24/2019, 1:17 PM
Also in Gradle 5.6 you can use plugins block settings.gradle to specify versions of all dependencies
m
mbonnin
08/24/2019, 1:52 PM
But even if I add both android and jvm plugins to the root gradle file with
apply(false)
, I still need to apply them in the modules, right ?
mbonnin
08/24/2019, 1:53 PM
Should I apply them using the
plugins {}
block or the regular
apply(plugin = "org.jetbrains.kotlin.android"
?
g
gildor
08/24/2019, 2:07 PM
Yes, apply them in submodules using plugin block, but just omit version, because those plugins are in classpath already