Android sdkmanager tool was found, but failed to run (already updated)

129 Views Asked by At

I am trying to solve this problem with flutter doctor. I tried every kind of method, but it still appears. I have the Java 8 version and I have installed all the things from android studio. The app still run, but I am scared that this issue can create some problems in future. How can I solve (MacOS)?

~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.9, on macOS 13.1 22C65 darwin-arm64, locale
    it-IT)
[!] 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.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.86.0)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.
~ % flutter doctor --android-licenses
Errore: LinkageError durante il caricamento della classe principale 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/ricca/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 tried to manage JAVA_HOME, ANDROID_HOME, to reinstall the build-tools in android studio. I also tried to install Java17, but I understood that probably it was not the best solution.

1

There are 1 best solutions below

0
On

First of all, make sure that all java versions are up to date and the paths are set, then open android studio, right click on androrid in your project. Then click on Flutter and Open Android Module, then it will warn you to update Gradlew in the lower right corner of the screen that opens. Finally, under File, click invalidate Caches, select all options, let the application restart, then run the command again.