kotlin-gradle-plugin is used to compile Kotlin code with Gradle. Basically, its version should correspond to the Kotlin version you want to use. E.g. if you want to use Kotlin 1.0.3, then you need to aplly kotlin-gradle-plugin version 1.0.3 too.

It’s a good idea to externalize this version in [gradle.properties](<https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties>) or in [ExtraPropertiesExtension](<https://docs.gradle.org/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html>):

buildscript {
   ext.kotlin_version = '1.0.3'

   repositories {
     mavenCentral()
   }

   dependencies {
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
   }
}

Then you need to apply this plugin to your project. The way you do this differs when targeting different platforms:

Targeting JVM

apply plugin: 'kotlin'

Targeting Android

apply plugin: 'kotlin-android'

Targeting JS

apply plugin: 'kotlin2js'

These are the default paths:

You may need to configure [SourceSets](<https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSet.html>) if you’re using custom project layout.

Finally, you’ll need to add Kotlin standard library dependency to your project:

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}