Gradle Build error for gradle version 6.6.1

Hi All,
We have started getting build error suddenly and this does not seems to be specific to code changes as the build do not work even without pulling any recent changes. Below is the error -

Could not determine the dependencies of task ':<module-name>:check'.
> Could not create task ':<module-name>:test'.
   > org.gradle.api.tasks.testing.Test.setForkEvery(J)V

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Anybody has faced this issue earlier, if yes, can you please guide how to resolve this, build is not happening for any module. Thanks.

The method that is not found was introduced in Gradle 8.1.
So you probably use a plugin that is not compatible with Gradle <8.1 in a build that is using Gradle <8.1.
With --stacktrace or --scan you should see where exactly this is coming from.