androidkotlingradlekotlin-gradle-plugin

What's the difference between 「Kotlin Plugin Version」 and 「Kotlin Gradle Plugin Version」?


What's the difference between 「Kotlin Plugin Version」 and 「Kotlin Gradle Plugin Version」?

・Kotlin Plugin Version
The version of KotlinPlugin that can be found at [File]->[Settings]->[Plugins] enter image description here


・Kotlin Gradle Plugin Version
The version of KotlinGradlePlugin described in the project's build.gradle enter image description here

Should these two values be the same? If anyone can tell me, could you please let me know?


Solution

  • The Kotlin Plugin you mentioned first is an IDE plugin - it helps your IDE understand the Kotlin language, provide intentions, syntax highlighting, compile errors in the editor etc. It only matters in the IDE, mostly when editing the code.

    The Kotlin Gradle Plugin is a plugin meant for the Gradle build tool. This is the actual thing that compiles your code and runs the tests. It's the version that your published artifacts will depend on ultimately.

    You don't have to have the same version for both, but you should probably make sure the IDE plugin has a version more recent or equal to the Gradle plugin. You should select the version for the Kotlin Gradle Plugin based on what Kotlin version you actually want to use in your project. For the IDE plugin, the latest stable version is usually best, because the latest Kotlin IDE plugin should understand that your Gradle configuration wants to use a lower version of Kotlin, and thus act accordingly.