It has several benefits over java. However, some drawback is also because it is just beginning of Android App development java so we have very less tutorial also.Table of Content
- Setting up the environment
- Setup Project in Kotlin
- Create Hello World App and test
Step1: Setting up the environment for Kotlin in Android Studio
First of all, we have to setup the development environment for kotlin. So follow the as below given steps to setup the same.
- Open Android Studio
- Click on File
- Click on Setting and type ‘plugin’ in search box
- Click Browse Repository
- Type Kotlin as given in below in search box
- Select kotlin and click on Install, it will take some time and install the plugin
- Click ok and apply
- Restart Android Studio
Well done you have done with environment setting.
Step2: Setup the Project
Click on File and then click on New Project but not create any activity, select add no activity.
Given a name to your Project like here I given HelloKotlin.
3. Create your first Kotlin Activity as main activity
Right click on your root folder of your project as given in below screen shots.
Click on Configure and select the options Android with Gradle, then select the appropriate option and press ok.
Finally, Click on Sync Project.
When you try to run your app then you might get the error saying the default app/activity not set so for that you can click on setting and setup the default app and modify your activity in AndroidManifest.xml file as given below.
Now Test your App you and check the working of the app. It will look like as given below.