Terminal: flutter doctor View flutter development environment
Pro:~ w$: flutter doctor Doctor summary (to see all details, run flutter doctor -v): [?] Flutter (Channel stable, 3.10.6, on macOS 13.4.1 22F770820d darwin-x64, locale zh-Hans-CN) [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) ? cmdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools;latest"` See https://developer.android.com/studio/command-line for more details. ?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) ! CocoaPods 1.10.2 out of date (1.11.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. [?] Chrome - develop for the web [?] Android Studio (version 2022.2) [?] IntelliJ IDEA Ultimate Edition (version 2023.2) [?] VS Code (version 1.80.0) [?] Connected device (3 available) [?] Network resources ! Doctor found issues in 2 categories.
1. Problem: Android toolchain – develop for Android devices (Android SDK version 30.0.3) configuration problem
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) ? cmdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools;latest"` See https://developer.android.com/studio/command-line for more details. ?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.
Processed by:
Step 1: Enter the following command in the terminal to install the cmdline-tools component
Pro:~ wj$: /Users/xxx/Android/sdk/tools/bin/sdkmanager --install "cmdline-tools;latest"
Step 2: Terminal input flutter doctor –android-licenses
Note: If the following problem occurs: Android sdkmanager tool was found, but failed to run (/Users/Dish-B/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.
Pro:~ wj$: flutter doctor --android-licenses Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" 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 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495) Android sdkmanager tool was found, but failed to run (/Users/Dish-B/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.
Pro:~ wj$: flutter doctor --android-licenses Error: LinkageError while loading main class com.android.sdklib.tool.sdkmanager.SdkManagerCli java.lang.unsupportedClassVersionerror: COM/Android/SDKlib/Tool/SDKMANAGER/SDKMANAGERCLI HAS Compiled by more Recent Version of the Java Runtime (CL Ass File Version 61.0), this version of the java runTime only records class file versions up to 55.0 Android sdkmanager tool was found, but failed to run (/Users/Dish-B/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.
Solution method: This problem may be caused by the jdk version required by the latest version of command-line higher than the jdk version used. Reinstall the command-line 8.0 version.
Install the command-line version via Android Studio:
Perfect result:
[?] Android toolchain - develop for Android devices (Android SDK version 34.0.0) ? Android SDK at /Users/Dish-B/Android/sdk ? Platform android-33, build-tools 34.0.0 ? Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java ? Java version OpenJDK Runtime Environment (build 17.0.6 + 0-17.0.6b802.4-9586694) ? All Android licenses accepted.
2. Problem: Xcode – develop for iOS and macOS (Xcode 14.3.1) configuration problem, caused by CocoaPods version too low
[!] Xcode - develop for iOS and macOS (Xcode 14.3.1) ! CocoaPods 1.10.2 out of date (1.11.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
Solution method: update CocoaPods version
Pro:~ w$: sudo gem install cocoapods
Perfect result:
[?] Xcode - develop for iOS and macOS (Xcode 14.3.1) ? Xcode at /Applications/Xcode.app/Contents/Developer ? Build 14E300c ? CocoaPods version 1.12.1