Android Studio Gradle project sync failed

Just a blind guess: try to add something like this to your gradle.properties file in the project:

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m

Same issue solve in Android studio by

File -> Settings -> Compiler (Gradle-based Android Projects)

Change the "**VM options**" to 
-Xmx512m -XX:MaxPermSize=512m

It worked for me .


The only way I've been able to fix this when it happens is by doing

./gradlew clean 

and

./gradlew --refresh-dependencies

and then restarting Android Studio.

If that doesn't work I usually resort to reimporting the project.