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)
Try to refer to Java version 11 instead of 1.8