Gradle - Could not target platform: 'Java SE 8' using tool chain: 'JDK 7 (1.7)'

前端 未结 9 950
执笔经年
执笔经年 2020-12-12 19:57

I am trying to import Gradle project in Intellij Idea with local Gradle distrib and getting stacktrace with the following message: Could not target platform: \'Java SE

9条回答
  •  一整个雨季
    2020-12-12 20:44

    And so I see from other answers that there are several ways of dealing with it. But I don't believe this. It has to be reduced into one way. I love IDE but, but if I follow the IDE steps provided from different answers I know this is not the fundamental algebra. My error looked like:

    * What went wrong:
    Execution failed for task ':compileJava'.
    > Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'.
    

    And the way to solve it scientifically is:

    vi build.gradle
    

    To change from:

    java {
        sourceCompatibility = JavaVersion.toVersion('11')
        targetCompatibility = JavaVersion.toVersion('11')
    }
    

    to become:

    java {
        sourceCompatibility = JavaVersion.toVersion('8')
        targetCompatibility = JavaVersion.toVersion('8')
    }
    

    The scientific method is that method that is open for argumentation and deals on common denominators.

提交回复
热议问题