1
  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

6
  • Do you have the kotlin plugin installed/activated? Commented Jul 4, 2016 at 9:41
  • @voddan yes I have. I tried many versions, including the latest. No use. Commented Jul 4, 2016 at 10:31
  • Are you able to create a Kotlin project from project templates, using the last stable AS and Kotlin plugin? Does it run? Commented Jul 4, 2016 at 10:53
  • @voddan No I created a Android project. I tried to add a kotlin file and failed. Commented Jul 4, 2016 at 11:35
  • I understand. Are you able to perform the action above, ei create a new Kotlin project and run it? Commented Jul 4, 2016 at 12:03

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

3 Comments

You are right. My *.kt extension is registered under java class type. After I created the type Kotlin and add *.kt & *.kts extension under it, problem solved. Thanks a lot!
This seems to be a common cause for problems. Is it going to be fixed soon?
@Cheng You don't need to create the Kotlin type. The type is there when the plugin is installed. If you created your own file type, you will be able to edit the files, but no other features such as code navigation and refactorings will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.