8

I am using Kotlin DSL with Gradle build tool. My gradle build works well both locally and on jenkins server when run from command line.

However IDEA complains and marks several items red with the following errors:

  • Cannot access class 'java.lang.Object'. Check your module classpath for missing or conflicting dependencies
  • None of the following functions can be called with the arguments supplied

I have tried all 3 options in project settings: - Use default gradle wrapper - Use gradle 'wrapper' task configuration - Use local gradle distribuition

Result if pretty same

QUESTION: is something wrong in config, or is there a fix or workaround for that?

IntelliJ IDEA 2018.1.2 (Community Edition)
Build #IC-181.4668.68, built on April 24, 2018
JRE: 1.8.0_152-release-1136-b29 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-20-generic

.

Kotlin plugin: 1.2.41-release-IJ2018.1-1

.

Gradle 4.7
------------------------------------------------------------

Build time:   2018-04-18 09:09:12 UTC Revision:     b9a962bf70638332300e7f810689cb2febbd4a6c

Groovy:       2.4.12 Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017 JVM:          1.8.0_171 (Oracle Corporation 25.171-b11) OS:           Linux 4.15.0-20-generic amd64

None of the following functions can be called with the arguments supplied

Cannot access class 'java.lang.Object'. Check your module classpath for missing or conflicting dependencies

UPD: @tweitzel you are right, it was incorrect SDK setting, thanks!

ludenus
  • 1,161
  • 17
  • 30
  • 3
    Please check that you have a JDK set up (Project Structure -> SDKs). Please check that your project has a JDK configured (Project Structure -> Project, check Project SDK). Please check that your module(s) have a JDK listed (Project Structure -> Modules -> Dependencies) – tweitzel Apr 30 '18 at 14:12
  • @tweitzel you are right, it was incorrect SDK setting, thanks! – ludenus Apr 30 '18 at 14:50
  • 2
    In my case, it was not a problem with Project Structure. Suprisingly, deleting Intellij config directory in user home solved the problem. – brabec Feb 12 '19 at 14:18

1 Answers1

2

in my case I had set a jdk as File->Project Structure... -> Project->Project SDK

instead of setting the Kotlin SDK

after setting Kotlin SDK as Project SDK my build.gradle.kts errors disappeared

Dirk Hoffmann
  • 1,444
  • 17
  • 35