In this tutorial, we shall learn to create an Android Application with Kotlin language support.

When we create a new Android project with Kotlin support, the Activity file shall be created with Kotlin code.

Following is a screenshot of what we shall achieve by the end of this tutorial.

Kotlin Android Application Example

Kotlin Android Application Example

For creating this example application, we used Android Studio 3.0. At the time of writing this demo application, we have Android Studio 3.0 Canary 2, which is a kind of preview version of Android Studio 3.0.

You may download the latest version of Android Studio from https://developer.android.com/studio/.

Once you install Android Studio 3.x or higher, follow the below steps to build our first Kotlin Android Application.

Step 1: Start Android Studio

From your programs, start Android Studio application. You will get a welcome screen as shown below.

Android Studio Welcome Screen - Kotlin Android Application Example - www.tutorialkart.com
Android Studio Welcome Screen

Step 2: Include Kotlin Support

Provide Application Name, Company Domain and check the option “Include Kotlin Support” and click on “Next”.

Android Application Name - Kotlin Android Application Example - www.tutorialkart.com
Android Application Name and Location

Step 3: Minimum SDK

Select the “Minimum SDK” and to continue, click on “Next”.

Selection of Application Parameters - Kotlin Android Application Example - www.tutorialkart.com
Selection of Application Parameters

Step 4: Select Activity

Select “Empty Activity” and click on Next.

Select Empty Activity - Kotlin Android Application Example - www.tutorialkart.com
Select Empty Activity

Step 5: Activity Name

Remain “Activity Name” as is and click on Finish. We are half-way there.

Activity Name - Kotlin Android Application Example - www.tutorialkart.com
Activity Name

Android Studio starts building project information for “KotlinAndroidDemo”. For the first build, it may take some time.

Building Project Information - Kotlin Android Application Example - www.tutorialkart.com
Building Project Information

Step 6: Install missing platform(s)

If Gradle project sync fails when the project is opened for the first time, click on the link “Install missing platform(s) and sync project” in “Messages” window the missing components are downloaded and installed by Android Studio.

Install missing platform(s) - Kotlin Android Application Example - www.tutorialkart.com
Install missing platform(s)

Once the installing of platforn(s) is finished, Gradle sync is tried again, and this time it should be successful.

The MainActivity in the java folder is a Kotlin file and yaaay, we are using Kotlin language in our Android Application.

Step 7: Run

Run the application by connecting an Android Smart Phone to the computer in Debugging mode or with the help of emulator.

Conclusion

In this Kotlin Android Tutorial, we created an Android Project with Kotlin Programming Language support. In our next tutorial, we shall learn to convert Java Files to Kotiln Files in existing Android projects.