Build fails with OutOfMemoryError after updating gradle plugin from 2.1.3 to 2.2.0. (Android Studio, Mac)

I’m using gradle on the Android studio on mac. It worked well last week, but now has some error after updating the plugin from 2.1.3 to 2.2.0. When I try to build or clean project, the CPU usage reaches about 100% and gradle fails with the following.

"Error:Execution failed for task ‘:app:mergeReleaseFlavorDebugResources’.
java.lang.OutOfMemoryError: unable to create new native thread

I think it is not actually the OOM because there is about 10G of unused memory when it occurs.
Any wisdom will be appreciated.

It works well after downgrade to the 2.1.3. But still don’t know the reason :neutral_face:
Is there any additional config changes that I should make after the plugin update? ?

I also having the same problem. Failed when using 2.2.0 but downgrade to 2.1.3 working fine. Another thing I want to mention is it only happen to one of my android project. Do share if you found any solution.