Error on compilation

Android studio 1.5.1
Plugin 1.0
On compilation I have got this error time to time.
Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’.

com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java’’ finished with non-zero exit value 1

For solve this problem I should clean project and restart IDE.
Regards

I solve this problem by adding
dexOptions {
javaMaxHeapSize “2g”
}
to gradle
android {}