IntelliJ/Gradle Could not determine java version from '11.0.1'

S34N :

I'm running a Linux Ubuntu 18 OS. Installed jdk in a custom local directory.

Normally, IntelliJ recommends that you use the default gradle wrapper. But in my case, I want to be able to change the Gradle Version on the fly whenever it's due for an update. If you use IntelliJ with Gradle, and you bump into the following error:

Could not determine java version from '11.0.1'
S34N :

If you use IntelliJ

Checks:

  1. Navigate to:

    File >> Settings >> Build, Execution, Deployment >> Build Tools >> Gradle.

    Alongside Gradle JVM: make sure you select the correct version of Java. Gradle JVM

  2. Navigate to: Right-Click 'Project Root Directory' & Select Open Module Settings. Project Structure windows shows-up. Make sure your JDK home path is added to the Platform Settings >> SDKs : JDK home path Project Structure >> Platform Settings >> SDKs : JDK home path

  3. Still, on the same window Project Structure, select correct SDK relevant to your project under

    Project Settings >> Modules : Module SDK Module SDK

  4. Fix/Solution: Nvavigate to & open: gradle/wrapper/gradle-wrapper.properties & update the distributionUrl version to the latest version. In my case (at the time of this post), my older version was:

    distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip

    And my latest version is:

    distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip

    As shown below:

    distributionUrl Version Update

  5. In your build.gradle file make sure you set:

    sourceCompatibility = 11

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=35447&siteId=1