Hi,
I find that a lot of people on the internet are reporting incompatibility between LibGdx, Java versions > 8/9 and Gradle versions >= 5.0.0. Well here is a work around that allows you to run LibGdx with Java 11, Gradle version >= 5.0.0 on the latest Eclipse version. You’re welcome.
Side Note : If you are just building your LibGDX project for the first time from the libgdx setup app and it fails, that’s OK. After you apply the solution the project will work.
Here is the solution :
Java versions > 9 and Gradle versions >= 5.0.0 has some code breaking changes. Here is to go around them using Eclipse. It should be similar in AndroidStudio.
- Install the latest version of gradle from its distribution site (“https://services.gradle.org/distributions/”) and unzip the it on your PC.
- When importing the gradle project in eclipse select the option “local installation directory” and point to the folder where you unzip gradle.
- (Bonus) if it is a LibGDX project, you need to also change the following in the Desktop build file due to code breaking changes between gradle versions <5.0.0 and >=5.0.0. Change “sourceSets.main.output.classesDir” to “sourceSets.main.output.classesDirs”.
This is working for me and I am using LibGDX with Java 11 and Gradle 5.2.1 on Windows 10 while running Eclipse 2018-12.