Kotlin Configuring Kotlin build Using Android Studio


Example

Android Studio can configure Kotlin automatically in an Android project.

Install the plugin

To install the Kotlin plugin, go to File > Settings > Editor > Plugins > Install JetBrains Plugin... > Kotlin > Install, then restart Android Studio when prompted.

Configure a project

Create an Android Studio project as normal, then press Ctrl + Shift + A. In the search box, type "Configure Kotlin in Project" and press Enter.

Dialog of "Configure Kotlin" search result

Android Studio will alter your Gradle files to add all the necessary dependencies.

Converting Java

To convert your Java files to Kotlin files, press Ctrl + Shift + A and find "Convert Java File to Kotlin File". This will change the current file's extension to .kt and convert the code to Kotlin.

Convert Java file to Kotlin file