libgdx: Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.

Issue details

Unable to find method ‘org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V’.

Reproduction steps/code

Upgrade android Gradle plugin to 3.4.0 version and Gradle 5.1.1

Version of LibGDX and/or relevant dependencies

GdxVersion = 1.9.9 Android gradle plugin = 3.4.0 KotlinVersion = 1.3.31 GradleVersion = 5.1.1

Stacktrace

Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.
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.

Please select the affected platforms

  • Android
  • iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 16 (4 by maintainers)

Most upvoted comments

SampleProject/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip ▼ change distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip

Update the classpath ‘com.android.tools.build:gradle:3.1.0’ in your project gradle.

Update the classpath ‘com.android.tools.build:gradle:3.4.1’ to latest version in your project gradle.

Face the same issue, but not sure how to solve this. Did change the gradleVersion to 5.4.1, same issue. Any hint?

you should use gradle 4.6 with libgdx projects.

@ozanurkn and @tlshenm Thanks so much for the replies! This issue was fixed for me by going to gradle-wrapper.properties and changing distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip to distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip Then, I went to build.gradle and updated classpath ‘com.android.tools.build:gradle:(old version)’ to classpath ‘com.android.tools.build:gradle:3.1.0’ Then I updated buildToolsVersion ‘(old version)’ to buildToolsVersion ‘27.0.3’

Build is complete with no errors!

The method setBootClasspath was removed from the class org.gradle.api.tasks.compile.CompileOptions in the gradle version v5.0.0. Using the gradle version below v5.0.0 (i.e. v4.9.0) solved the problem in my case.

For me, I changed it to distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip (I needed to use 5.3 because of Kotlin)

And, classpath 'com.android.tools.build:gradle:3.4.1'

I used 5.1.1 because the project uses higher than 4.6 version. And solved the problem.

ozanurkns answer and tlshenms answer combined worked for me

I removed ios-moe module and error is gone that mean problem is in ios-moe module.

i’ m going to test the solution described in the following posts on the libGDX forum: https://www.badlogicgames.com/forum/viewtopic.php?f=11&t=28943 and (referred to) https://www.badlogicgames.com/forum/viewtopic.php?f=11&t=28658. In case it will work, we shall update the gradle files in the snapshot and close the issue !