Kotlin 1.2.50 causing java.lang.IllegalStateException ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler

After upgrading to Kotlin 1.2.50, I am getting the following whenever I attempt to build my project using Gradle 4.8. Downgrading Kotlin to 1.2.41 eliminates the error below.

e: java.lang.IllegalStateException: The provided plugin org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:188)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:120)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:433)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:295)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:147)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:95)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:50)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:88)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:454)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:101)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:224)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:36)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:86)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:98)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:545)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:418)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:927)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:957)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:926)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:417)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.AbstractMethodError: org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar.registerProjectComponents(Lorg/jetbrains/kotlin/com/intellij/mock/MockProject;Lorg/jetbrains/kotlin/config/CompilerConfiguration;)V
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:186)
… 41 more

3 Likes

Did you update the Kotlin plugin in your IDE?
I had the same error until I updated the Kotlin plugin in IntelliJ

This error is happening when doing a command line build using Gradle 4.8. The link below contains a sample project that demonstrates when I am seeing. Download/unzip the file and then, go into the project directory and run ./gradlew clean build.

https://drive.google.com/open?id=1WVwEBt6nueuJyJ2_hbDxtvQv65Ng5V8W

I have this error too, even with the latest version of Intellij (downloaded just fifteen minutes ago). Downgrading to 1.2.41 helps for me as well.

2 Likes

This is a really annoying issue. I confirm that when you use Gradle 4.8, I see that issue.

1 Like

I don’t believe that the Gradle version is the cause. I just switched the sample project I posted earlier to Gradle 4.7 and this issue still occurs. Here is the bug report for this issue. Please vote for it.

https://youtrack.jetbrains.com/issue/KT-24946

I don’t get any error when running ./gradlew clean build on the project directory

I’ll post additional environment info soon.

Keith Wedinger

keith.wedinger@icloud.com

Blog: https://jkwuc89@github.io

Twitter: @jkwuc89

GitHub: jkwuc89 (Keith Wedinger) · GitHub

LinkedIn: https://www.linkedin.com/in/kwedinger

Untappd: jkwuc89

Updating Kotlin IDE plugin fixes it for me. Thanks @SackCastellon!

I have two linux mint 18.3
One server not occur error, but the another server occur that error.
Its curious …

Android studio 3.1.3 + Gradle 4.8.1 + Kotlin 1.2.50, pop up the same error here.

This combination of settings fixed it for me in an IJ 2018.1 multiplatform project:

  • Gradle 4.8.1 (wrapper in case it matters)
  • Kotlin 1.2.51 plugin installed manually from the ideadev channel here
  • Kotlin 1.2.51
    1. add repository {maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } to all build scripts
    2. set buildscript { ext.kotlin_version = '1.2.51' } where appropriate

This all of course necessitates many other changes since few libraries are compiled with Kotlin 1.2.51.

Nevermind. I got the error again about an hour after I posted this. But switching the Gradle wrapper to Gradle 4.7 seems to have fixed it for now.

It cause kotlin 1.2.5x compiler.
use kotlin 1.2.41 compiler then excape this problem

I’m getting the same exception. Haven’t tried downgrading yet but did notice the following:

  • Building with Gradle 4.8.1 or wrapper 4.7 causes exception to occur
  • Building from within IntelliJ does not cause the exception to occur

Given there’s virtually no difference between running ./gradlew and an “installed” version of gradle, I think it’s safe to assume the issue affects building with gradle 4.7 - 4.8.1 However, IntelliJ must be doing something differently in order to succeed.

Anyone know what are the practical the differences between building from the command line with gradle and building in IntelliJ?

It seems to be related to SDKMan. If you’re using SDKMan, uninstall versions of Kotlin installed with SDKMan, and ensure all Gradle Daemons are stopped.

Try the build again, and it should work fine.

IntelliJ will use it’s own internal Kotlin compiler, OR delegate to Gradle build. Depends on your setting under build tools. You can use IntelliJ or delegate build to Gradle.

Another setting for tests.

2 Likes

I have the same problem in 1.2.51

1 Like

I can verify that executing “sdk rm kotlin 1.2.51” solved the problem for me.

This worked for me as well. I did have to restart my terminal since SDKman adds the KOTLIN_HOME env and that was still getting picked up. Once I restarted a new terminal it all worked via the command line and gradle wrapper (4.8.1).

2 Likes

What did the trick for me, was updating the IDE Kotlin plugin (as mentioned above), also the gradle wrapper to 4.7 and also cleaning the build for all of my project’s modules (for some reason, I had to do it manually to make it work).