Kotlin an official language on Android
- Now JetBrains introduced the Kotlin language.
- Kotlin is programming language runs on the JVM.
Why Kotlin For Android?
- Kotlin reduces the amount of boilerplate code.
- you can call into the Java language from Kotlin, and you can call into Kotlin from the Java language.
- Kotlin is expressive, concise, extensible, powerful, and a joy to read and write.
- Kotlin has safety features like nullability and immutability to increase the performance and health of the Android application.
install the Kotlin plugin
Kotlin plugin is inbuilt in android studio 3.0 version,For the earlier version, you can use following steps to install the Kotlin plugin in your android studio.
- open your android studio.
go to File files, select Settings.
|File > Settings|
2. In Settings, you can see the many items like Appearance, Editor, Plugins, version control and etc in these select Plugins.
3. Under plugin, you can see the Install JetBrains plugin at the bottom of the window.
The kotlin plugin installed in your android studio, Now you can develop the android application with kotlin language.Please check this installation of kotlin plugin in android studio.
First Kotlin android applicattion
Below, I am going to show you how to develop kotlin android application in android studio.
1. open android studio and create new project.
|Create new project|
After entering the Application and company domain click Next,
In my case, I have named the application name as FirstKotlinApp.
Then, Select for what purpose you are going to develop this application like Mobile and Tablet and wear or TV.
Please select Mobile and Tablet, press Next,
|Mobile and Tablet|
Create new Blank Activity to start the app as a Normal blank activity,
In this step It will ask you to configure the Activity Name and Layout Name, In my project I set the default name for both activity and layout.
Now you can see the default java android project be created.
In the enter action search for “Convert Java File to Kotlin File” then press enter to convert the java files into Kotlin files.
|Kotlin not configured|