I could solve the similar problem.
Replace the "build.gradle"
compileOptions { sourceCompatibility JavaVersion.VERSION_18 targetCompatibility JavaVersion.VERSION_18 } kotlinOptions { jvmTarget = JavaVersion.VERSION_18.toString() }
Open "View -> Gradle -> Gradle Setting" and change "Gradle Jdk:" to "correto-18"
If nothing "corret-18", you can download it.
I'm not sure detail but I think mismatching JDK is resonate the problem.