操作无法完成。无法找到 Java 运行时。有关安装 Java 的信息,请访问 http://www.java.com

Yas*_*ula 4 java android android-studio flutter apple-m1

我无法在 android 模拟器或 android 手机上运行 flutter 应用程序。我在 m1 mac 上安装了最近发布的适用于 arm-mac 平台的 android studio。如果我在这里做错了什么,或者是发布本身的问题,请回答。

调试控制台输出:

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Exception: Gradle task assembleDebug failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

颤振医生 -v 输出:

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
[?] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-arm, locale en-IN)
    • Flutter version 2.2.1 at /Users/hmnth/FlutterDev/flutter
    • Framework revision 02c026b03c (10 weeks ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/hmnth/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /usr/bin/java
    ? Could not determine java version

[?] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.2

[?] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    ? Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio
    • Android Studio at Applications/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    ? Android Studio not found at Applications/Contents
    • Try updating or re-installing Android Studio.

[?] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107

! Doctor found issues in 3 categories.
Run Code Online (Sandbox Code Playgroud)

小智 19

2023年。

转到应用程序 -> 右键单击​​ Android Studio -> 选择“显示包内容”。

我只有文件夹 .jbr (没有 .jre)。因此,我创建名为 .jre 的新文件夹,并复制文件夹“Contents”(来自 .jbr)-> 粘贴到 .jre 文件夹。

打开终端并运行:flutter doctor -v

这对我行得通。

  • 还可以创建软链接 `ln -s "/Applications/Android Studio.app/Contents/jbr" "/Applications/Android Studio.app/Contents/jre"` (3认同)

Med*_*aly 7

转到应用程序然后右键单击 Android Studio,然后选择显示包内容,在其中创建一个jre名为的新文件夹jdk并将其内容复制jrejdk

这是修复的链接https://github.com/flutter/flutter/issues/76215#issuecomment-864407892

  • 一定要复制,而不是移动。 (6认同)
  • 这对我不起作用 (3认同)

Sha*_*tim 5

我遇到这个问题是因为我没有安装Java。如果您在“系统偏好设置”下看不到 Java 图标,则表明未安装 Java 7 或更高版本。链接到 java.com