7

I've just updated Android Studio to 2.2 and now my Kotlin project won't build. The gradle synch works fine, but when attempting to build I'm immediately presented with an error that reads:

Error:Execution failed for task ':app:compileDebugKotlin'.
> Could not initialize class com.intellij.ide.highlighter.JavaFileType

I've checked that my Kotlin plugin is up to date. This error sounds like something to do with the IDE and highlighting Java code? Any help would be appreciated.

1
  • 2
    Which Kotlin compiler version are you referencing in your build.gradle? Commented Oct 10, 2016 at 10:43

2 Answers 2

9

Open Tools | Kotlin | Configure Kotlin Plugin Updates in the main menu, then choose Check for Updates. Be sure that yo're using Stable channel.

Close Android Studio, go to your project's directory, and delete build and app/build folders. Run Android Studio. Deleted folders would be recreated.

Hope it will help

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

1 Comment

Yes, this was the solution (worked it out myself, but ups to you for following through with such a nice clear answer).
6

In my case the kotlin plugin was not updated as @piotrek1543 said in other answer.

In addition to that the build.gradle had an old Kotlin version number 1.0.1-2 and the IntelliJ said in a warning on top of to switch to the current bundled version 1.0.4.

Now with the kotlin version like this the error is gone:

ext.kotlin_version = '1.0.4'

Comments

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.