Kotlin is fully supported with android studio v3.0 and Higher.
-
Setup Kotlin to Android Studio
Important : The android studio version must be 3.0 or higher
To add Kotlin support to the android studio we need to install the Kotlin plugin for your Android Studio.
To add the Kotlin plugin open
Android Studio File → Settings → Plugins →type “Kotlin” in search box → Click Browse in Repositories → install → Restart Android studio to activate the Plugin
Add Kotlin to the existing project
Add classpath in project level build.gradle.
Also here defined a variable kotlin_version as ext.kotlin_version = ‘1.2.41’ to share the version to all.
<// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2. Add dependencies to app level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
dependencies {
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Create a new project with Kotlin
Open android studio then click File –> New project you will get a window like below

Mark ” Include Kotlin Support “
Press Next–>Opens a page to select minimum SDK version — select API v15
Press Next –>Opens a page to select the default activity type — Choose Empty Activity from the list
Press Next –> Opens a page to change the default activity name
Press Finish — >Opens A new Android Project with Kotlin Support.