java.lang.IllegalArgumentException: 不支持 class 文件主要版本 57

java.lang.IllegalArgumentException: Unsupported class file major version 57

我在构建 application.Any 时遇到错误,将不胜感激。

根目录:build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

settings.gradle

include ':app'

应用程序:build.gradle

apply plugin: 'java'

compileJava {
    options.compilerArgs << '-parameters'
    options.fork = true
    options.incremental = true
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.squareup:javapoet:1.10.0'
    implementation ("org.checkerframework:checker:2.1.10")
    testImplementation 'org.mockito:mockito-core:3.2.0'
}

FAILURE:Build failed with an exception. *Where:Settings file'/Users/Documents/android/MyApplication5/settings.gradle' *What went wrong:Could not compile settings file'/Users/anand/Documents/android/MyApplication5/settings.gradle'.>startup failed:General error during semantic analysis:Unsupported major version 57 java.lang.IllegalArgumentException:Unsupported major version 57

1error

确保 pom.xml 文件中的目标版本和源版本相同。 编辑:Java 9+ 没有单独的 JRE,因此请确保您的 JRE 路径指向您的 JDK.