Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibGDX Gradle Language Level Keeps resetting

Before I ask, I have looked around and I do not see any other questions with similar problems as I, Currently I'm using the nightly build of LibGDX with Gradle and everytime I try to set the java language level to 7.0 or even 8.0 it refreshes gradle and then forces the language level back to 6.0, everything i read states that gradle has no control over the language level, yet that's when it forces a change, is there something that I am over looking? I've tried using File | Project Structure | Project Language Level, I've tried setting each module to 7.0 and I've tried setting the default language level for intellij, only reason I need 7.0 is for the ability to use the string type for a switch case. Any help would be greatly appreciated.

like image 238
MCWizard111 Avatar asked Oct 20 '22 08:10

MCWizard111


2 Answers

You need to set the language level in the Gradle build script (e.g. sourceCompatibility = 1.7).

like image 143
Peter Niederwieser Avatar answered Oct 23 '22 03:10

Peter Niederwieser


I was hitting a similar problem with trying to use Java 8 for a desktop-only build. I had to add the following to the desktop and core sections to get it working:

compileJava {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}
like image 44
dmccabe Avatar answered Oct 23 '22 03:10

dmccabe