This happened when I upgraded to Gradle 5.0 from 4.10.3, and also the Android Gradle Plugin from 3.2.1 to 3.3.0-rc03 (the latter because it's the first version of AGP to officially support Gradle 5).
When I attempt to sync my project after this, I get an error. The error only says:
* What went wrong:
Metaspace
Subsequent builds either also emitted this error, or something even more obscure, like:
* What went wrong:
Could not initialize class com.gradle.scan.a.e.c
There's no obvious solution to this problem. A search for "gradle metaspace" turns up release notes for Gradle 5, which themselves only refer to it here:
#7385 - Limit Metaspace used by Gradle
And the issue itself isn't the most helpful.