I am new to Android Studio.I installed Android Studio-1.2.1.1 and i have jdk1.7.0_40 installed.I am facing problem with gradle build. For reference you can check gradle issu
For those who are on OS X El Capitan (v10.10) and end up with the above error message.
In my case there was nothing wrong with Gradle, simply my Java 1.8 was "too new" for Android Studio 1.5 so I had to install older 1.7.
I downloaded it from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html (jdk-7u79-macosx-x64.dmg)
After all I had to just update JDK location in the project structure