skip to Main Content

I searched for a possible fix for this but I didn’t find any. I tried pretty much all of it. Last test was removing Java and Android from MacOS and installing them again.

I’m using Flutter and when running flutter doctor this is what I get:

[✓] Flutter (Channel stable, 3.13.0, on macOS 13.5.1 22G90 darwin-arm64, locale en-ES)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.69.2)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.

So I run flutter doctor --android-licenses and then I get this 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/dani/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.

Where are this different versions coming from? My Flutter apps were running fine and without changing anything this started to fail (I realised when creating a new project)

2

Answers


  1. Try to refer to Java version 11 instead of 1.8

    Login or Signup to reply.
  2. I was dealing with this issue, since I had a previous older installation of flutter and android-studio on my machine in a different folder, flutter was still trying to access that. After I deleted that folder I had to update my flutter config to point to the correct directory and sdk.

    Side note on JDK versus Android Studio. Android Studio comes with a version of java so you shouldn’t need the JDK separately. If you set any path variables you can delete them.

    Make sure you know what directory flutter is pointing to for your SDK.
    to find this out run Flutter config -h

    This will give you a list of settings. At the very bottom it will show you settings that you have set (possibly from an older installation).

    In my settings the "android-studio-dir" and "android-sdk" settings had to be updated because they were still pointing to an old installation of android-studio.

    These commands helped fix my issue.

    flutter config –android-studio-dir "[path of your android studio installation]"

    flutter config –android-sdk "[path of your SDK folder]"

    After this, running flutter doctor again you should be able to go through and accept the licenses.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search