The version of my java is 21.
However the error says it’s looking for v17.
I tried to find and fix the problem. But there aren’t any solution to this available. I am trying to avoid reinstalling Android Studio.
This is mac m1. Please guide me here.
[1
2
Answers
I was able to resolve this with the help of chatgpt...
Flutter was pointing to the wrong jdk all this while...
Run the cmd:
flutter config --list
I got this...
jdk-dir was set to old version of java...
I was able to update this with the following cmd
flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
Now when I run
flutter doctor
, I'm getting thisI think the issue lies with the version of java used by default. Android studio V34 (at least the gradle version, which some plugins may use) uses Java 17. Take a look at https://developer.android.com/build/jdks#compileSdk and see if this might help.
PS – I don’t think you need to reinstall Android Studio, just install the version of Java it wants