IntelliJ has stopped printing stack traces when my app fails - intellij-idea

I have frequently been seeing this error in IntelliJ (Ultimate 2020.2.3):
Cause: cannot assign instance of java.util.Collections$EmptyList to field java.lang.StackTraceElement.moduleVersion of type java.lang.String in instance of java.lang.StackTraceElement
It doesn't seem to be able to show me any stack traces from my app. This behavior started with an upgrade some weeks back.
I tried running with --stacktrace but it made no difference.

I had the same problem after I updated my IntelliJ to the latest (2021.2 Ultimate). I managed to fix the issue by changing the Gradle JVM from the Project SDK to the one from Gradle directory (AdoptOpenJDK 11.0.9 in my case).

Related

IntelliJ error - could not open init generic class cache for initialization script

enter image description here
enter image description here
I was trying to download IntelliJ and learn Kotlin, but i get a BUG error before i am starting, and i dont now what to do..
I have try to delete the scipts folder, but it just make a new scipts folder, and say the same error. I have also reinstall IntelliJ, and thats give the same error.
Is der someone there can help me? :-)
Could not open init generic class cache for initialization script 'C:\Users\username\AppData\Local\Temp\wrapper_init4.gradle' (C:\Users\username.gradle\caches\6.6.1\scripts\3yb5naxddghzghazzdf2vk0em).
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 60
As per the details in your error message, you can see that the root cause is a gradle error.
Gradle is likely using an unsupported version of the JVM in your case (e.g. I could reproduce the error in the latest IntelliJ 2021.3 version where gradle was using JVM 17 from my home path, while the IDE itself was using JDK 11.) In the attached IntelliJ Preferences screen, note that the JVM used by Gradle is specified separately.
To fix the error, verify the JVM version being used by gradle and specify a JVM 11 version to gradle.
IntelliJ Gradle Preferences Screenshot:
You should set these options when you create your project enter image description here
Or, when creating a project, choose Java - Kotlin\JVM
For me this problem occurred when i was using wrong JDK file to build the project that is the Gradle JDK used was a normal SE JDK rather than one preferred by Android Studio so you follow the following steps to solve it.
Go to Settings (ctrl + alt + s)
Go to Build,Execution and Deployment
Then select Build Tools > Gradle
Change Gradle JDK to jbr-17 (the one i am using) you can prefer to choose options from Android studio Java Home or Default JDK

Unable to load class 'kotlin.coroutines.Continuation'

This error keeps happening every once in a while in my Kotlin projects. I tried several Kotlin versions (1.3.41, 1.3.60, 1.3.72) but this seems to come up on any version and in various projects. Once it starts happening, I can't build any project.
Full error message:
Unable to load class 'kotlin.coroutines.Continuation'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt.
Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I have tried all the suggestions and none of it helped. When I click
"Re-download dependencies and sync project (requires network)", it says
Clicking "Stop Gradle build processes (requires restart)" restarts Intellij but doesn't help.
Closing Intellij and killing Java processes didn't help either.
While none of the linked suggestions in the error popup worked, running 'clean' gradle task manually did do the trick!
./gradlew clean
The error still comes up every once in a while but can be reliably fixed by running gradle clean.

Can not import libgdx project to Intellij IDEA 14

I want to import libgdx project to Intellij IDEA 14 with gradle 2.4. But I can not do. Because when I try to import, Intellij gives error that "resolve error, Already created an SDK Loader with different SDK Path".
I set sdk.dir in local.proporties file. Also I did not set ANDROID_HOME in path.
How can I proceed?
I had the same problem. I wonder if it was caused by using IntelliJ after using Android Studio on the same machine? I got rid of this problem by deleting ~/.gradle but I think that caused other problems, because the libgdx project wouldn't build the desktop module before running it, then kept hanging with high CPU load when I clicked the build button. I ran the project's gradlew in a terminal to see what would happen, and it downloaded a new zip of gradle and seems to have fixed the problem.

Gradle project sync failed with no event log

I have a libGDX project generated by the gdx-setup.jar tool, including core, android, desktop, and html modules. I hadn't touched any of the gradle files, and my build has worked fine for some weeks.
This morning when I opened IntelliJ IDEA (build 135.1230), it offered to update the Scala plugin, so I accepted and restarted, before trying to open the project. My libGDX project doesn't use Scala at all: I have the plugin for other work. When I tried to open the project, I got the infamous "Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly" message. Clicking "Try again" thinks for a bit before showing the same message. The Event Log window contains no output, and the Messages window says:
Error: (of class java.lang.String)
The Scala plugin isn't the only thing that might have changed: I've rebooted the (Ubuntu) machine since the project last worked, so it's possible that some package updates might have only just had an effect.
Following the advice of others, I've tried editing the root gradle.properties to change org.gradle.configureondemand to false, and that made no difference. I've tried performing "Build → Clean Project" and "Invalidate and Restart", with the same effect. I've also tried running git clean -X and reimporting the Gradle project into IDEA, but I just get a "Resolve error" dialog with the same message as above.
Running a build command like
./gradlew android:assemble
from a shell still works fine: only IntelliJ IDEA has a problem.
Even if you've never seen this particular problem, I'd appreciate any tips on where to start debugging it. The error message doesn't exactly give me a lot to go on.

Unable to debug a Gradle + Dropwizard Project from IntelliJ IDEA

I am currently unable to debug an application that uses gradle + dropwizard from IntelliJ IDEA
I imported the project using the JetGradle plugin and I am launching the "run" task in debug mode from the plugin itself.
I am using this sample project:
https://github.com/quad/dropwizard-gradle
The project actually runs but the breakpoints are never hit.
Anything I may be missing that prevents me from debugging this simple app from IntelliJ ?
There could be many reasons why the debugger isn't stopping at a breakpoint, and from your description it's unclear if the problem is related to (Jet)Gradle. That said, the JetGradle plugin in IDEA 12 is very limited, and I recommend to use Gradle's idea plugin instead. Alternatively, try an early access preview of IDEA 13, which has a much improved Gradle integration.