I migrated an existing android project to android studio ladybug. I am stuck with this error
Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.4. Cannot sync the project.
It seems to pick up Java 21.0.3 from /Applications/Android Studio.app/Contents/jbr/Contents/Home
. This is what I tried
- Went to File -> New Project Setup -> Project Default Structure -> Gradle and updated Default Gradle JDK as
/Users/ashwin/.sdkman/candidates/java/11.0.25-ms
(this contains bin/java and has java 11). It accepts this as a valid jdk. - As mentioned here I set the environment variable STUDIO_JDK as
/Users/ashwin/.sdkman/candidates/java/11.0.25-ms
But both/either of these don’t seem to have any effect. I get the same error complaining of Java 21.0.3 incompatibility. What could be going on here and how can I fix this?