Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug mode stopped working in IDEA with Kotlin

I have been working on a project for a while now and on one day I tried to run my project in debug mode and I got this error message:

Failed to find Premain-Class manifest attribute in C:\Users\myuser\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlinx\kotlinx-coroutines-core-metadata\1.3.8-native-mt-1.4.0-rc\5b54677a19ebb20ec7dac0d9e4dfc806df327df\kotlinx-coroutines-core-metadata-1.3.8-native-mt-1.4.0-rc.jar
Error occurred during initialization of VM
agent library failed to init: instrument

I tried

  • Invalidate cache and restart
  • Reimporting the project
  • Deleting the .gradle folder from the project and my HOME dir

but nothing helped.

What can I do to solve this? I did no code change that could make this happen, it was working a day ago.

like image 493
Adam Arold Avatar asked Aug 31 '20 09:08

Adam Arold


People also ask

Why debug mode is not working in IntelliJ?

To solve this, simply remove the jar of the debugged module from all modules' dependencies in the Project Structure. If you do not know which modules have the debugged module jar as dependencies, you can use some tools (Eg. Sublime Text, bash, ...) to search for the module name which is stored in Intellij *.


1 Answers

This is a bug in the new Kotlin 1.4 coroutine debugger: https://youtrack.jetbrains.com/issue/KT-41175. As a workaround please do in Intellij IDEA: File | Settings (Preferences) | Build, Execution, Deployment | Debugger | Data Views | Kotlin | Disable coroutine agent.

The coroutine debugger is going to be disabled in MPP projects by default in Kotlin 1.4.10.

like image 78
Alexey Belkov Avatar answered Oct 05 '22 10:10

Alexey Belkov