Creating an Android app with Kotlin support

Let's walk through the following steps to create an Android project with Kotlin support:

  1. First, we need to open Android Studio on our development machine. If you don't already have Android Studio installed, you can find the download and installation instructions at https://developer.android.com/studio/install.
  2. Select Start a new Android Studio project.
  1. Select Empty Activity, and then click Next, shown as follows:

  1. Update your project NamePackage name, and Save location, as shown in the following screenshot:

  1. Ensure that Kotlin is selected in the Language drop-down menu, and then click Finish. This will ensure that Kotlin is the default language for the project and that the IDE generates new code using Kotlin rather than Java:

At this point, you will have a buildable Android project with Kotlin support, something similar to what is shown in the following screenshot:

To see how Kotlin is configured for the project, open the root-level build.gradle file. In this case, it's the build.gradle file labeled Project: HelloKotlin. See the following screenshot:

This is the project-level build.gradle file.

There are two key things to be aware of in this build.gradle file:

Finally, if you open the build.gradle file labeled as Module: app, you'll notice three things:

The following screenshot shows these elements:

At this point, you're now ready to start writing your Android app with Kotlin. In the next section, we'll explore how Kotlin can make that process easier.