LibGDX Gradle Language Level Saves Reset

Before I ask, I looked around and I do not see any other questions with similar problems like me. I am currently using the nightly build of LibGDX with Gradle and every time I try to set the java language level to 7.0 or even 8.0 it updates Gradle and then forces the language level back to 6.0, all I read says that Gradle does not have control over the level of the language, but when it forces a change, is there something I am looking for? I tried using File | Project structure | Project Language Level, I tried to set each module to 7.0, and I tried to set the default language level for intellij, the only reason I need 7.0 is the ability to use the string type for the switch case. Any help would be greatly appreciated.

+4
source share
3 answers

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

+2
source

I ran into a similar problem when trying to use Java 8 for builds only for desktop computers. I had to add the following to the desktop and main sections in order to make it work:

compileJava {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}
+1
source

, "sourceCompatibility". -, sourceCompatibility gradle Java. libGDX gradle Android, :

http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7

"android" gradle build script :

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

.

0

Source: https://habr.com/ru/post/1540553/


All Articles