IntelliJ IDEA Buildtools 24.0.2 requires Java 1.8 or above. Current JDK version is 1.7
Solution 1
After checking IDEA global settings I've found solution:
https://www.dropbox.com/s/26mz2d2mbir1r2j/Screen%20Shot%202016-09-01%20at%209.56.37%20PM.png?dl=0
Preferences -> Build, Execution, Deployment -> Gradle -> Gradle JVM -> Set to 1.8 and this works!
Solution 2
Since you successfully built it in the command line, it seems like it's a problem with your project JDK. The JDK location setting is located in File>Project Structure>SDK Location --> JDK Location
. If it says anything about jdk1.7.0
, then switch the jdk to 1.8 by clicking the ...
button to the right of the prompt and give it the file path of jdk1.8.
EDIT: If you don't know the path of the jdk, run ls -l 'which java'
in the terminal.
Solution 3
Make sure you have correct versions defined under: File -> Project Structure -> Project -> Project SDK -> Project Language Level (this is for mac, but I think you can find it for windows using the same logic).
Alexander Efremenkov
Updated on August 28, 2022Comments
-
Alexander Efremenkov over 1 year
After trying to build my project in Mac OS X El Capitan I've got this error:
Error:Gradle: A problem occurred configuring project ':app'. Buildtools 24.0.2 requires Java 1.8 or above. Current JDK version is 1.7.
I have project with
build.gradle
section like this:android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
Also:
Project SDK 1.8.0_101
App Module: android sdk 24, jdk 1.8,
Root Module: android sdk 24, jdk 1.8
compileSdkVersion 24
buildToolsVersion '24.0.2'
minSdkVersion 16
targetSdkVersion 24
retrolambda
P.S.: I successfully built this project from command line.
-
Alexander Efremenkov over 7 yearsIDEA doesn't contains
SDK Location
menu. IDEA only haveProject
menu which have 1.8 with/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
path . Your advice actual only for Android Studio. -
Alexander Efremenkov over 7 years
which java
says:/usr/bin/java
-
Deniss M. over 7 yearsDid you check the solutions in this thread: stackoverflow.com/questions/30631286/…
-
Alexander Efremenkov over 7 yearsThis solution for android studio, please check links before answering
-
Deniss M. over 7 yearsCan you post a screenshot of your project structure tab? The solutions in that thread could also work if you are not using android studio.
-
Alexander Efremenkov over 7 years
-
Deniss M. over 7 yearswas this project initially created in android studio? or intellij idea?
-
Alexander Efremenkov over 7 yearsIt's doesn't matter because project successfully builds from command line.
-
Deniss M. over 7 yearsit does matter for your IDE, because it doesn't build your project. If you had it in Android Studio initially and want to move it / moved it to IntelliJ Idea maybe this can help you: jetbrains.com/help/idea/2016.2/…
-
Carter Brainerd over 7 yearsif you type
ls -l 'which java'
it outputs -->/usr/bin/java -> /Library/Java/JavaVirtualMachines/JDKNUMBERjdk/Contents/Home/bin/java
@AlexanderEfremenkov -
Alexander Efremenkov over 7 yearsDo you really about Mac OS? Because I've this:
ls: which java: No such file or directory
-
Alexander Efremenkov over 7 yearsThis advice not help dude
-
Carter Brainerd over 7 yearstry
ls -l
`which java` (tics instead of single quotes)