4
votes

I'm a newer to gradle,and when i open a gradle application with idea,Then it throw an error Gradle 3.1 requires Java 7 or later to run. Your build is currently configured to use Java 6.

My gradle info:


Gradle 3.1

Build time: 2016-09-19 10:53:53 UTC

Revision: 13f38ba699afd86d7cdc4ed8fd7dd3960c0b1f97

Groovy: 2.4.7

Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015

JVM: 1.8.0_60 (Oracle Corporation 25.60-b23)

OS: Mac OS X 10.11.6 x86_64


idea

enter image description here

error

enter image description here

idea setting

file -> other settings -> default project setting

enter image description here

EIDT

Log

2016-10-30 14:25:06,941 [1651420]   INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at '/Users/famoss/Downloads/btrace-master/gradle' 

org.gradle.tooling.GradleConnectionException: Could not create an instance of Tooling API implementation using the specified Gradle installation '/Users/famoss/Downloads/gradle-3.1'.

Caused by: org.gradle.internal.jvm.UnsupportedJavaRuntimeException: Gradle 3.1 requires Java 7 or later to run. You are currently using Java 6.
2
What does the log say? - Makoto
@Makoto,I added the log to the content. - Baby.zhou
You might want to try older version of Gradle. I had the same problem with Gradle 3.1 at home. Now I'm at work and everything is working with Gradle 2.3. The other difference is IntelliJ version: IntelliJ IDEA 2016.2.4 at work, some older version at home. But I bet Gradle version makes a difference. - Patrycja K

2 Answers

3
votes

Update the idea version to 2016.2.5 and the problem solved.

0
votes

Check your local.properties file to see which version of java gradle is trying to reference. This file should be in the same directory as your gradle file.

Typically this file is automatically configured on project creation, but it depends on your intellij settings.