Class 'Kotlin.Unit' was compiled with an incompatible version of Kotlin

I just created a Kotlin project for the first time ever (its the Java timed robot template, converted to Kotlin using the Kotlin for FRC extension) and I’m getting this error:

Why is that, and what should I do to fix it? Do I need to install an older version of Kotlin?

Also, I feel like I should mention that when I build robot code, it says “build successful in 2 seconds”. is that unusual?

Update: in the build.grade file, I changed kotlin.jvm version from 1.8.0 to 1.6.0 and ran build again. It said build successful in 2 minutes, which is reassuring, but the same error is still there…

I ran into this with a project of my own. I haven’t found a solution, but I think that the issue is with the fwcd VS Code extension. If the build is successful but the intellisense isn’t, that suggests that it’s actually an issue with the JDK instance that’s running the language server. I thought it might be related to this issue but setting the kotlin home to the same place as java home didn’t seem to resolve the issue.

When you changed the kotlin jvm version, it forced it to rebuild all files, which is why it said 2 minutes instead of 2 seconds. If you’re building and nothing changed, gradle won’t regenerate the files, so it finishes quickly.

UPDATE: It appears that this issue is related. Until they tag a new release, there’s not much that can be done short of building the language server yourself.

I restarted the language server while the version in build.gradle was 1.6.0, and it worked perfectly - thank you! Guess I’m staying with that version for now.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.