I have been working with Android Studio for a while. Recently I have heard about kotlin programming language and I wanted to try to include a class in kotlin language to my project.
There is the problem that whenevr I want to create a new Activity for example, the .java class is auto-generated. Also I see no way to cretae a .kt (kotlin) file manually.
So does anyone know how to setup a .kt file in Android Studio, so that I am able to fill it with code in kotlin language?
解决方案
First, install Kotlin plugin in Android Studio. Restart Android Studio.
Now create a new project with no activity.
Then navigate to src>main>java>.
Right Click on , select New>Kotlin Activity and go ahead with configuration.
Now naviagte to src>main>java>/.kt and open it.
After opening it, you will see Kotlin not configured message.
Just click configure action and run your project. That's it!