Add Kotlin to Existing Java Android Project

Jun 11, 2019

Try to add a kotlin file: File -> New -> Kotlin File/Class.

The following Configure Kotlin shall be prompted.

Android Configure Kotlin

Android Configure Kotlin

The following shall be added to Project build.gradle.

buildscript {
    ext.kotlin_version = '1.3.31'
    ...
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

Module build.gradle

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

...

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

Reference:

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.