Pas*_*ian 37 macos mobile android flutter
系统设置:
\nMacOS 文图拉
\nAndroid Studio 电鳗
\n我正在我的 Intel Mac 上安装 Flutter。
\n跑步后flutter doctor
结果是这样的:
\n[\xe2\x9c\x93] Flutter (Channel stable, 3.7.0, on macOS 13.2 22D49 darwin-x64, locale\n en-MX)\n[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)\n \xe2\x9c\x97 Android license status unknown.\n Run `flutter doctor --android-licenses` to accept the SDK licenses.\n See https://flutter.dev/docs/get-started/install/macos#android-setup for\n more details.\n[\xe2\x9c\x93] Xcode - develop for iOS and macOS (Xcode 14.2)\n[\xe2\x9c\x93] Chrome - develop for the web\n[\xe2\x9c\x93] Android Studio (version 2022.1)\n[\xe2\x9c\x93] VS Code (version 1.74.3)\n[\xe2\x9c\x93] Connected device (2 available)\n[\xe2\x9c\x93] HTTP Host Availability\nRun Code Online (Sandbox Code Playgroud)\n运行后flutter doctor --android-licenses结果是这样的:
Exception in thread "main" java.lang.UnsupportedClassVersionError: \ncom/android/prefs/AndroidLocationsProvider \nhas been compiled by a more recent version of the Java Runtime (class file version 55.0),\nthis version of the Java Runtime only recognizes class file versions up to 52.0\nRun Code Online (Sandbox Code Playgroud)\n我于 2023 年 1 月从这里通过此链接安装了 Java for Mac
\n有人遇到过同样的错误吗?你怎么修好它的?
\nabd*_*_bd 13
对于 Windows
从 [Java SE Development Kit 19.0.2][1] 下载并安装最新的 JDK
将系统变量设置为
变量名:JAVA_HOME
变量值:C:\Program Files\Java\jdk-19
添加路径变量名称为%JAVA_HOME%\bin
现在运行flutter doctor
希望,它会解决。[1]: https: //www.oracle.com/java/technologies/downloads/#jdk19-windows
虽然可以通过 Oracle 下载安装 JDK,但确保您在 MacOS 上拥有正确版本的最佳方法是使用 Homebrew 安装 JDK(如果您没有 Homebrew,安装说明: https: //docs.brew.sh/安装)。此外,通过这种方式保持最新状态要容易得多。
brew install openjdk
Run Code Online (Sandbox Code Playgroud)
如果您安装了其他 OpenJDK 版本,您可能需要链接这个正确的版本:
brew link --force openjdk@19
Run Code Online (Sandbox Code Playgroud)
要使其成为 shell 的默认值,请将以下行添加到 ~/.zshrc:
export JAVA_HOME="/opt/homebrew/opt/openjdk"
export PATH="$JAVA_HOME/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
进而:
source ~/.zshrc
Run Code Online (Sandbox Code Playgroud)
您只需执行一次此操作。
然后重新运行:flutter doctor --android-licenses
| 归档时间: |
|
| 查看次数: |
35659 次 |
| 最近记录: |