Kick starting Android Development with Kotlin — Setting up Android Studio

Akshay Chordiya
AndroidPub
Published in
2 min readMar 21, 2017

Content

In this article we will only focus on how to setup Kotlin in Android Studio.

In case you missed my previous article or don’t know about Kotlin then check this article (Why Kotlin-ize your Android Development)

Setting up Kotlin in Android Studio

It’s pretty easy to setup Kotlin in Android Studio because it’s based upon IntelliJ IDE made by JetBrains which also happens to be the makers of Kotlin. Hence making a tighter integration between Kotlin and Android Studio.

Kotlin Plugin

Initially we need to install the Kotlin Plugin in Android Studio.

Steps to install the plugin:

  • Open Android Studio Settings (Ctrl + Alt + S)
  • Go to Plugins
  • Install only the “Kotlin” plugin
  • Restart the IDE
Installing Kotlin Plugin in Android Studio

Now your Android Studio has got the power to write Kotlin code.

Configure Project with Kotlin

Once we have created a new Android project. We need to configure Kotlin for the project.

PS: Before doing this, create a new Android project as you usually do

  • Go to Tools > Kotlin > Configure Kotlin in Project

After doing this, Android Studio will automatically make the necessary changes to your project files. You need might to “Sync” it.

Convert Java to Kotlin file

If your new project has some existing Java files. You can convert them into Kotlin file using the following steps:

  • Open the required Java file or select the required Java files
  • Open Action Window (Ctrl + Alt + A)
  • Click on “Convert Java file to Kotlin File

It automatically changes your Java code into Kotlin code and I have to say it works pretty good.

Thanks to the Kotlin plugin which makes it easier to start building Android apps in Kotlin

Run, Kotlin, Run

That’s all. Just run your Android app on a real device or a emulator.

What’s next

In the next articles we will dive deep into the coding part and look more into Kotlin features for Android.

--

--

Akshay Chordiya
AndroidPub

Google Developer Expert @ Android | Android Engineer @ Clue | Instructor @Caster.IO