
Finally, Google has accepted Kotlin as the official language for Android app development. This doesn’t mean we have to stop making apps using JAVA. You can, but Kotlin makes the process more simple and efficient.
These are some points I want to discuss with you about Kotlin,
- Interoperable – It is based on JVM. So you can use Kotlin wherever you use JAVA
- Concise – It is easy to read, write, maintain and need less code when compared with JAVA
- Kotlin supports Object-Oriented Programming and Functional Programming
- Code is safe – You can say goodbye to NullPointerException. If you assign a null value to an object reference, It will easily found at compile time. But you can assign a null value to a variable by explicitly adding “?” (Question mark) after the data type
- reduces boilerplate code –
- No more findViewById() calls – Kotlin Extensions plugin helps us to access UI widgets using id.
- No need to type data class’s setter ,getter, and toString() like methods (functions in Kotlin). Kotlin compiler will automatically generates these methods.
- There is no need for the semi-colon, Actually Kotlin allows it. But does not force it.
Do you think It’s better to start making apps with Kotlin ?. Then we will help you to complete the First step.
Yes, installing the Kotlin plugin in Android Studio.
After installation, Android Studio able to achieve Kotlin code compilation, execution, Unit Testing, and debugging.
You can also convert Java code to Kotlin in a single click. Click below link to find out
If you are using Android Studio 3.0 and above just like me, you don’t need to worry about Kotlin plugin. That’s already set for you. You can create a Kotlin project from now.
If you are using android studio 2.3 or below, you need to perform below steps to work with Kotlin.
Let’s launch Android Studio.
If you are already opened a project, select File-> close project to land welcome page of Android studio.
Click on configure button and select plugins option.
Click Install JetBrains plugin button
1. Search “Kotlin” without quotes or you can scroll down the list and find Kotlin.
2. Click on Kotlin plugin item
3. On the right section of the window, click on the Install button.
Download starts…
After a short time, when download completes. Install button becomes “Restart Android Studio“. Click on that.
Next dialog box appears. Click Restart to activate changes in plugins.
From now, Android Studio is fully compatible with Kotlin.
While creating a project, Check Include Kotlin support, then all are as usual.
Conclusion
One of the simple language Kotlin finally added to Android Development world. Kotlin has lots of advantages over Java. That will ease your development process, at the same time you can make the app more efficient. You can easily start building Android apps in Android Studio by just installing the Kotlin plugin. Since Android Studio 3.0, You don’t need to install it, they come with inbuilt support. Even though Kotlin does not have resources for learning like Java. But it will benefit in the long run. That’s all. Thanks for scrolling… Please share it.