I had the same issue, this problem will be fixed by doing the below step.
Go to
File->Setting->Gradle->Gradle Vm Option
For Android Studio 1.2
File->Setting->Build, Deployment &Execution->Build Tools->Gradle->Gradle Vm Option
, Now put this value -Xmx256m in the box, and hit the Apply button.