Kotlin application build error due to "Failed to initialize class com.intellij.ide.highlighter.JavaFileType"

I just updated Android Studio to version 2.2 and now my Kotlin project will not be created. Gradle sync works fine, but when I tried to build, I immediately found an error that reads:

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

I checked that my Kotlin plugin is updated. Does this error sound somehow related to the IDE and highlight Java code? Any help would be appreciated.

+5
source share
2 answers

Open Tools | Kotlin | Configure Kotlin Plugin Updates Tools | Kotlin | Configure Kotlin Plugin Updates Tools | Kotlin | Configure Kotlin Plugin Updates in the main menu, then select Check for Updates . Make sure you use the Stable channel.

Close Android Studio , go to the project directory and delete the build and app/build folders. Launch Android Studio. Deleted folders will be recreated.

Hope this helps

+5
source

In my case, the kotlin plugin has not been updated as @ piotrek1543 said in another answer.

In addition to this, build.gradle had the old Kotlin version number 1.0.1-2 , and IntelliJ said in a warning from above to upgrade to the current version in 1.0.4 bundle.

Now with this version of kotlin the error has disappeared:

 ext.kotlin_version = '1.0.4' 
+5
source

Source: https://habr.com/ru/post/1257941/


All Articles