Google has officially made Kotlin as the official programming language for Android programming. The Kotlin support comes Pre-build with the Android Studio 3.0 and Up versions. But even if you are not having the most latest version of Android Studio with you, you can still use the Kotlin language in your Android Application project. This tutorial shows you the step by step procedures to install and setup-Up Kotlin language to your existing Android project.

Installing the Kotlin Plugin

The first step is to install the Kotlin puglin. After that you can configure the Kotlin plugin to any project. So First,

Step 1 : Open the Android Studio.

Setting Kotlin Language For Android Studio choose settings from the file menu techusall
Step 2 : Go to File -> Settings(Preferences in MAC OS) -> Plugins -> Browse -> Repositories…

Setting Kotlin Language For Android Studio select browse repositiory to add external plugins online

Step 3 : Browse for the “Kotlin” plugin. Install the plugin and wait fore the installation to complete.

 

Setting Kotlin Language For Android Studio installing kotlin from the repository

Configuring Kotlin With the Existing Project

Now the installation is completed successfully. Now you have to open the project on which the Kotlin is to be configured. Once your have opened the target project,

Step 4 : Go to Tools -> Kotlin -> Configure Kotlin in Project. Click “OK” When the Configure Kotlin in Project Dialog Box Appears. This will take you to the Gradle file of your project. To configure your project with the Kotlin Language you will have to configure the Gradle too. Click on the “sync now” link on top of the window to sync the Gradle with the Kotlin Plugin. If any error appears at the time of syncing, feel free to comment it out. ! 🙂

Setting Kotlin Language For Android Studio configure kotlin in project

Setting Kotlin Language For Android Studio syncing the gradle to the project

Converting the JAVA files into Kotlin

Step 5 : Go to  Code -> Convert Java File to Kotlin File. This converts all the JAVA files in your project into the Kotlin File. After this you can freely mix the Kotlin Language As well as the Java language in your project according to your need.

Setting Kotlin Language For Android Studio convert java file to kotlin file

 

You have now completely setup the Kotlin Language in your Android Project.