The latest Android SDK does not support GradleException(), instead use FileNotFoundException().
Or for future readers, maybe use RuntimeException (if the issue is not file related).
I found the issue and the solution on this GitHub thread:
https://github.com/flutter/flutter/issues/29608