What does the kotlin_version value do?

In many Gradle scripts, and in Gradle code autogenerated by IDEA or Android Studio, I can find this line:

val kotlin_version by extra("1.4.10")

It is located in a buildscript block.

What does this do? What is this extra property? Is this for specifying the kotlin version? The kotlin line in the plugin block already does that, doesn’t it?

extra just contains user defined values/properties.

https://docs.gradle.org/current/userguide/kotlin_dsl.html#extra_properties

That’s useful since you can use the kotlin_version property instead of typing “1.4.10” everywhere. It can be named whatever you want (e.g. super_duper_version_of_kotlin would work just as fine)

1 Like