flutter doctor 认证问题

运行flutter doctor发现sdk需要认证,如下图

C:\Users\*****>flutter doctor
Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 3.17.0-3.0.pre.19, on Microsoft Windows [版本 10.0.22621.2428], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.5.1)
[√] Android Studio (version 2021.2)
[√] VS Code, 64-bit edition (version 1.83.1)
[√] Connected device (4 available)
[√] Network resources

! Doctor found issues in 1 category.

按照提示运行flutter doctor --android-licenses,直接报错如下图

C:\Users\****>flutter doctor --android-licenses
Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
����: �������� com.android.sdklib.tool.sdkmanager.SdkManagerCli ʱ���� LinkageError
        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 (C:\Users\****\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat): "exited code 1".
Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.

 问题大概就是说java编译版本比运行时版本高,需要版本一致,版本一致后重新认证即可。

posted @ 2023-11-08 11:06  0Behavior  阅读(291)  评论(0编辑  收藏  举报