Check your module classpath for missing or conflicting dependencies

MadLax picture MadLax · May 12, 2018 · Viewed 39.6k times · Source

I have a project with Java and Kotlin, which I am able to successfully run and build. However, when I open the project in IntelliJ, I see the same error in many of the project files.

The error is "Cannot access class 'java.lang.String'. Check your module classpath for missing or conflicting dependencies"

See the error in the image attached: enter image description here


Another example of an error occurs when initializing a Kotlin MultiPlatform Mobile project:

cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.RepositoryHandler'. Check your module classpath for missing or conflicting dependencies

What is the source of this error? How can I fix it?

Answer

dexter2305 picture dexter2305 · May 20, 2019

If your project is set with a JDK, then probably IDE (Intellij) does not have JDK set but your built application could run just fine with the required JVM.