I am trying to set up flutter with VS Code in Ubuntu. I have followed the installation guide and have installed the latest cmdline tools as required by the flutter doctor.
Now this is the output I get on running flutter doctor again
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
On running flutter doctor --android-licenses
I get the following error
java.lang.UnsupportedClassVersionError:
com/android/sdklib/tool/sdkmanager/SdkManagerCli has been compiled
by a more recent version of the Java Runtime (class file version 61.0),
this version of the Java Runtime only recognizes class file versions up to 55.0
I tried upgrading to Java 17 using sudo apt install openjdk-17-jdk
and set up the environment variables but the problem still persists.
2
Answers
I had the exact same problem but on Windows.
I solved it by completely uninstalling JDK, which searching on internet turned out to be a possible problem, and installing the latest version (20).
I had the same problem and fix it by removing the version installed (openjdk-11-jre and openjdk-11-jdk) and installing the newest one (openjdk-19-jre and openjdk-19-jdk).