How can I set the version of Kotlin in Gradle?
I see that each Gradle version comes with its own Kotlin.
How do I tell it to use another one (I want to use the latest Kotlin compiler)?
Asked
Active
Viewed 1,737 times
0

msayag
- 8,407
- 4
- 30
- 29
-
Have your tried with exclusion? https://docs.gradle.org/current/userguide/dependency_downgrade_and_exclude.html – Nikola Despotoski Sep 29 '21 at 14:10
-
Do you mean the version of Kotlin that Gradle is using or the version of Kotlin used in your project that is defined by Gradle? – Tenfour04 Sep 29 '21 at 14:46
-
2If you want to change the version of Kotlin that Gradle depends on, can you update your question to explain why - what problem are you trying to solve, or what would this change allow you to achieve? Each Gradle version depends on a specific version of Kotlin, so changing the version doesn't really make sense. https://stackoverflow.com/a/55864903/4161471 – aSemy Sep 29 '21 at 15:43
1 Answers
0
In order to use the latest Kotlin compiler, add this to your build.gradle(.kts)
plugins {
kotlin("multiplatform") version "1.5.31"
}
You can replace "1.5.31" with the version you want.

JustinW
- 2,567
- 1
- 13
- 29
-
2Note that this is the version used for building kotlin (in this example multiplatform) projects, not the kotlin version used by the gradle itself. It's unclear which one they are asking about. – somethingsomething Sep 30 '21 at 07:46
-
Yeah, but isn't it that a gradle version can only use a specific kotlin compiler for DSL? – JustinW Sep 30 '21 at 08:05