After a lot of surfing, i found out the problem is GC overhead (out of memory). By adding below code to my build.gradle saved my day.
android {
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g" // 2g should be also OK
}
}
reference - ProcessException: org.gradle.process.internal.ExecException finished with non-zero exit value 2