In hindsight I should not have enabled L build stuff.
I am new to programming and I created a new Android Studio project which is throwing the Gradle errror right aw
I too faced the same issue and after days of trouble I figured it out. Just check if Java is installed
java -version
Any version above JDK 6 is OK
open -a TextEdit ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export JDK_HOME=$(/usr/libexec/java_home)
source ~/.bash_profile
Now try gradle sync now, you must be able to complete sync