These plugins provide integration with different other Gradle plugins. They both setup compiling Kotlin for the JVM, but aim to interoperate with different other tools.
org.jetbrains.kotlin.android
or kotlin-android
This plugin offers integration of Kotlin with the Android Gradle plugin, which should also be applied to the project. The Kotlin compilations are set up to be included in the builds of Android variants (e.g. debug
, release
, testDebug
etc.)
The IDs kotlin-android
and org.jetbrains.kotlin.android
designate the same Gradle plugin. The only difference is that the "full" ID org.jetbrains.kotlin.android
can be used for resolving the plugin from the Gradle Plugin Portal, while the shorter ID kotlin-android
can only be used for applying the plugin if you already have it on the build classpath (i.e. it's added elsewhere).
org.jetbrains.kotlin.jvm
(also has a shorter alias kotlin
)
This is the plugin for building Kotlin projects that target JVM without Android support.
The plugin offers integration with the Gradle java
plugin (as well as java-library
or application
). The project that applies this plugin can also use Java sources. The Kotlin compilations are wired with the java
plugin's source sets (main
and test
by default)
Normally you should only apply one of these plugins, depending on whether you target Android or "standard" JVM. If you need to target both platforms, you should use the Kotlin Multiplatform plugin by ID org.jetbrains.kotlin.multiplatform
, which adds the DSL to setup the targets in the project. Those might include jvm()
and android()
, as well as other targets: JS, WASM, Kotlin/Native.
org.jetbrains.kotlin.android
the one should I use as I want to omit the classpath? I am trying to useorg.jetbrains.kotlin.jvm
and you are correct as it gives me error upon syncingThe 'java' plugin has been applied, but it is not compatible with the Android plugins.
– Superadd