Error running 'flutter doctor --android-licenses': UnsupportedClassVersionError

43 views Asked by At

When I run flutter doctor --android-licenses on my macOS system, I encounter the following error:

Error: LinkageError occurred while loading main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
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
Android sdkmanager tool was found, but failed to run (/Users/username/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager): "exited code 1".

Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.

I've checked my Java version, and it appears to be up to date. Here are the details of my setup:

  • macOS operating system
  • Java version openjdk-21 (version 21.0.2)
  • Android SDK installed at /Users/username/Library/Android/sdk

I've tried reinstalling the Android SDK and updating Flutter, but the issue persists.

Could someone please provide guidance on how to resolve this error and successfully accept the Android SDK licenses using Flutter on macOS?

1

There are 1 answers

1
Ventus On

From flutter doctor --android-licenses gives a java error

Have you tried installing the Android SDK Command-line Tools package?