You can set the JDK Version used by gradle for the build by adding a “gradle.properties” file to your project. Add the following property:
org.gradle.java.home = <Path to the JDK you want to use for your project>
I agree with the previous answer that you also should check if the JDK and the sourceCompatibility match.