Kotlin not working on Android Studio

2019-03-02 21:31发布

问题:

  1. All kotlin files can't be displayed on my Android Studio. Even when you directly convert java files into koltin, you can edit it, but it doesn't appear on the project file tree. Also the IDE suggests that it's a decompiled .class file.

  2. I can't create Kotlin files. When I do, it shows a dialog that says

Cannot Create File / unable o parse template "Kotlin File" Error message: Cannot create class-file

  1. The plugin "Kotlin Extensions For Android(obsolete) can't be installed properly. I can click install, but it doesn't work.

My Android Studio Version 2.1.2

回答1:

Please make sure that the .kt extension is associated with the Kotlin files in Settings | Editor | File Types.

Also note that the reason why "Kotlin Extensions for Android (obsolete)" has the "obsolete" word in its name is specifically to let you know that you should not install that plugin.