Reputation: 81
I tried everything I installed every possible Java file a million times I installed the newest gradle version but it continues to show this error. I'm on Mac. Please help thanks
Upvotes: 7
Views: 4137
Reputation: 111
IF you do not want to develop for Android Java 11 works fine libgdx.
You have to change some things before everything builds and runs.
Here's what I did to get my project working.
My context Mac OSX 10.14 and openJDK 11.0.2
, new project, Desktop launcher and a bunch of Extensions (not important).
<project-dir>/gradle/wrapper/gradle-wrapper.properties
and change distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
into distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
.That resolves the java 11 error just to confront you with a new error Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
To get rid of that, open <project-dir>/desktop/build.gradle
and change line 27 (might be different for you)
from files(sourceSets.main.output.classesDir)
into
from files(sourceSets.main.output.classesDirs)
thats classesDir
into classesDirs
This should resolve all build errors and you're good to go.
Upvotes: 11
Reputation: 44
I am strongly recommend to use Java version not greater than 8. It is many incompatibility issues I faced just on 9 version of JDK in Android Dev environment.
Uninstall all java you have, use this article, because it is not as such easy without knowledge: https://www.java.com/en/download/help/mac_uninstall_java.xml
After download the 8th version from here: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I did same some time ago and all problems left
Upvotes: 1