help I have gradle 8.9

BUG! exception in phase ‘semantic analysis’ in source unit ‘BuildScript’ Unsupported class file major version 66

You are almost certainly not using 8.9 for that build, as running with Java 22 is supported since 8.8 and the error message suggests that you are running a Gradle version with Java 22 that does not support this. What you have installed locally is irrelevant and you do not even need any version installed locally, as the 4 Gradle wrapper files that should be included in all Gradle projects define and manage which version is used to run that build.