带有 Java 8 的 Flutter/Android SDK

带有 Java 8 的 Flutter/Android SDK

设置我的 Mac 以进行本地 Flutter 开发。我按照指南中提到的所有步骤进行了操作,安装了 Android Studio 并更新了 SDK。以下是我flutter doctor -v所说的:

user$ flutter doctor -v
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F132, locale en-IN)
    • Flutter version 1.7.8+hotfix.4 at /Users/yeshwanths/flutter
    • Framework revision 20e59316b8 (6 weeks ago), 2019-07-18 20:04:33 -0700
    • Engine revision fee001c93f
    • Dart version 2.4.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/yeshwanths/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/yeshwanths/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.3, Build version 10G8
    • CocoaPods version 1.6.1

[✓] iOS tools - develop for iOS devices
    • ios-deploy 1.9.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 38.2.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 38.2.4
    • Dart plugin version 192.6262.58

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.
user$

所以我用 Google 搜索并找到了这些链接:

我尝试了所有方法,但没有一个能解决这个问题,当我尝试时,flutter doctor --android-licenses我得到了这个错误:

A newer version of the Android SDK is required. To update, run:
/Users/yeshwanths/Library/Android/sdk/tools/bin/sdkmanager --update

但是我今天才从 Android 网站下载了 Android Studio 和 SDK。这非常令人困惑。有人能就此提出建议吗?

答案1

我也遇到了同样的问题。我尝试了所有可能的方法,但都没有用。剩下的唯一解决方案就是降级 Java 版本。

答案2

您可以尝试指定配置到您的 android studio 的android-studio-dir路径flutter config --android-studio-dir /path/to/android-studio,然后运行flutter doctor --android-licenses,您应该能够接受许可证。

相关内容