Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: LinkageError occurred while loading main class com.android.sdklib.tool.sdkmanager.SdkManagerCli

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.

like image 495
Bhav Khurana Avatar asked Sep 05 '25 03:09

Bhav Khurana


1 Answers

I was able to resolve this issue on Windows 10 with these steps

Install Android SDK Command-line Tools 8.0

  1. Using the Android Studio SDK manager, install Android SDK Command-line Tools 8.0. You may need to toggle the checkboxes highlighted in green to see the older versions like 8.0.
  2. Using windows explorer, navigate to the Sdk/cmdline-tools folder. On my system it's located at C:\Users\<USER_NAME>\AppData\Local\Android\Sdk\cmdline-tools.
  3. Rename the 8.0 folder to latest
  4. Run flutter doctor --android-licenses.
like image 109
Charis The Programmer Avatar answered Sep 07 '25 21:09

Charis The Programmer