For me, the problem was the gradle JVM not the Project SDK.
I had to remove the line <option name="gradleJvm" value="openjdk-24" /> in .idea/gradle.xml
<option name="gradleJvm" value="openjdk-24" />
.idea/gradle.xml