Kotlin Compile Error

已回答


Ok, so I've been using Intellij for years now (Ultimate) and this just started happening to me in the last month or so. Every time I try to compile a certain module in my project I keep getting an error that says Kotlin standard library not found in module graph. The error is attached.

The issue is... I've NEVER imported or wanted to use Kotlin. Never enabled it, never imported it, don't want it, don't care but EVERY time I try to compile I get this error. I've gone through every class in the module and checked imports and there's nothing unusual. Had this happen earlier this month and I removed the module, built a new one from scratch, and re-added in each class one by one. There were no errors for about a week and then boom it just started happening again today!

WHY is Intellij compiling Kotlin?????????????????????? Why Why Why?????? Can you sense the salt?

10
正式评论

Hello. This error should be reported when you author a Java 9 module in Kotlin and don't declare a `kotlin.stdlib` dependency: https://stackoverflow.com/a/48609922/992380 . If you don't have any modules like that, then it's probably a bug. We are not aware of any such bugs at the moment. In order for us to properly diagnose and fix it please file a YouTrack issue with your project attached (can be done privately): http://kotl.in/issue. Thank you.

Note: there is also a YouTrack issue to turn the error into a warning to facilitate debugging: https://youtrack.jetbrains.com/issue/KT-23592.

 

P.S. Would you please use https://discuss.kotlinlang.org/categories forum for Kotlin-related issues/questions. Thank you!

Yeah, I did not create a module in Kotlin and compiling works fine until it decides not to. Yesterday I did some serious debugging on this issue and I'm speculating that it's cause has something to do with refactoring a class name. Everything was fine, I renamed a class, and boom it started happening again last night.

Also to note, I've rebuilt this module FROM SCRATCH the first time it happened so I'm positive it's not a Kotlin module.

3

When I encountered the same problem last night, I searched Google for the solution and I came across this post. Then I figured out the problem. Build/Rebuild Project. I hope this also solves for your case.

13

So to Eakarahan I built and rebuilt (even started a brand new project) the project many times. The way I ended up fixing it was to 100% COMPLETELY disable the Kotlin plugin. This seemed to be the ONLY way to fix it.

4

It happens again and again at random intervals, and when it happens I rebuild the project. On my machine, "rebuild" works. According to your information, the bug is obviously in Kotlin plugin. Thus, the bug is located;  I hope they will fix it soon.

0

Rebuilding solved my problem.

1

Got the same issue when starting new project in Java, no Kotlin used. Rebuilding solved the issue (for now at least).

1

Pretty sure this occurs while refactoring. Rebuild didn't solve it for me. Will see if this is reproducible.

Copied the project root elsewhere and rebuilt. Then it used javac compiler. I was modifying this sample: https://openjfx.io/openjfx-docs/#IDE-Intellij (Modular project).

Perhaps the javafx wrapper throws off Intellij somehow.

 

 

1

I too encountered this problem. I created a simple JavaFX application, which worked fine. Then I tried to rename it from sample to something else and it suddenly stopped working with the Kotlin error. But when I removed the Kotlin plugin, suddenly the module info from my project was gone!

2

A workaround is to delete your "out" directory from the project.

1

Build/rebuild made no difference for me, but deleting the out directory per Klaus did solve it.

 

0

Can you please resolve this VERY ANNOYING bug? Please?

0

AAARRRRRGGGGGGGGGGG
GET RID OF THIS!

1

帖子评论已关闭。