Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle 4.7 targetCompatibility for JDK 10

Tags:

java

gradle

Anybody know what targetCompatibility value to use for JDK 10? Supposedly Gradle 4.7 supports it.

e: Currently using 1.10 but I can't find any confirmation that this is correct. java --version reports 10.x instead of the usual 1.x.x format.

like image 530
cbryant02 Avatar asked May 16 '18 01:05

cbryant02


People also ask

Which JDK is compatible with Gradle?

You can keep your project's source and target compatibility values set to Java 7, but you still need to compile using JDK 8. The Android Gradle plugin provides built-in support for using certain Java 8 language features and third-party libraries that use them.

Does Gradle 7 require Java 11?

Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: - changing the IDE settings.

Does Gradle work with Java 11?

When using an outdated version of Android Studio, you may encounter the following error message: > Failed to apply plugin 'com. android.


1 Answers

Set the Gradle version & Java Version in build.gradle as below

task wrapper(type: Wrapper){
         gradleVersion = '4.7'
     }

sourceCompatibility = JavaVersion.VERSION_1_10
targetCompatibility = JavaVersion.VERSION_1_10

Now, right click the build.gradle->Gradle->Refresh Gradle Project. And check the JRE System Library (Package Explorer view) contains JavaSE-10

Note: I am using Eclipse Oxygen IDE with Gradle IDE plugin.

like image 179
Ranjith Sekar Avatar answered Oct 09 '22 11:10

Ranjith Sekar