So I just bumped into this: ```The Kotlin Gradle p...
# gradle
m
So I just bumped into this:
Copy code
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
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
Also in Gradle 5.6 you can use plugins block settings.gradle to specify versions of all dependencies
m
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 ?
Should I apply them using the
plugins {}
block or the regular
apply(plugin = "org.jetbrains.kotlin.android"
?
g
Yes, apply them in submodules using plugin block, but just omit version, because those plugins are in classpath already
👍 1