Installing Kotlin in Android Studio

Kotlin is a modern language. It provides all the features of a modern language to Android developers. Kotlin is easy to learn and understand. The codes written in Kotlin is clean and simple. New developers will prefer learning Kotlin instead of Java for Android application development, on the other hand, it is quite easy for the experienced developers to pick up Kotlin in few hours.

Installing Kotlin in Android Studio is the very simple process. If you are using Android Studio version 3.0 or above, you don’t need to install Kotlin plugin separately, It is already pre-bundled with it.

If you are using an earlier version (below 3.0), you need to install Kotlin plugin.

Installing Kotlin in Adroid Studio

Open Android Studio and Go to Preferences => Plugins => Install JetBrains plugin

installing kotlin android studio

Search for Kotlin and Click Install to instal Kotlin plugin.

installing kotlin android studio

Downloading and Installation process starts now

installing kotlin android studio

Click on Restart Android Studio to complete the installation process.

installing kotlin android studio

Kotlin plugin has been installed now.

Hello World Android App in Kotlin

Create a new project in Android Studio with default configurations and settings, this process is same as in Java. It will create the project in Java

Convert Java code into Kotlin

Open Go to => Help => Find Actions

kotlin for android studio

Start typing “Convert Java to Kotlin” in the text field in order to invoke the action Convert Java File to Kotlin File. It will convert the Java code into Kotlin code and file extension has been changed from .java to .kt as shown in the below screenshot.

install kotlin android studio

Next step is to configure Kotlin. As soon as you begin editing MainActivity.kt, Android Studio will ask you to configure Kotlin.

install kotlin android studio

You will be prompted to select Kotlin version at the end of the configuration process. Select the latest version of Kotlin from the list.

install kotlin android studio

At this stage, Gradle files should be updated by Android Studio. You need to perform project sync by clicking on Sync Now

installing kotlin android studio

Below is the code of MainActivity.kt

Your first Kotlin Android application is ready. Run the application, you should get below output.

install kotlin android studio output

Some Usefull Android Development Tutorials

I hope you liked this tutorial. Subscribe to our Newsletter to get new articles and tutorials in your inbox as soon as they published. You can connect with us on Facebook and also subscribe to our Youtube Channel.

Check Also

asynctask kotlin example

Kotlin AsyncTask Tutorial with Example

Here is an example of implementing AsyncTask in Kotlin. I will create an Android application …