Yeah, I have it from time to time. Usually, I kill the gradle daemon and then restart the build.
It's annoying, I suppose there's a bugin how the forbidden-apis plugin works but it's a transient error so it's hard to debug.