简体   繁体   English

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

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

I couldn't run the flutter app on android emulator or android phone.我无法在安卓模拟器或安卓手机上运行颤振应用程序。 I installed the recently released android studio for arm-mac platform on m1 mac.我在 m1 mac 上安装了最近发布的 android studio for arm-mac 平台。 Please answer if I am doing anything wrong here or is it the problem with the release itself.如果我在这里做错了什么,或者是版本本身的问题,请回答。

Debug console output:调试控制台输出:

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

flutter doctor -v output :颤振医生 -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.

Go to Applications then right click on Android Studio, then choose "Show Package Contents", create a new folder inside jre named jdk and copy the contents of jre to jdk转到Applications然后右键单击Android Studio,然后选择“Show Package Contents”,在jre中创建一个名为jdk的新文件夹并将jre的内容复制到jdk

This is the link for the fix https://github.com/flutter/flutter/issues/76215#issuecomment-864407892这是修复链接https://github.com/flutter/flutter/issues/76215#issuecomment-864407892

I was able to fix my issues by doing the following, I sync my project with Gradle files我能够通过执行以下操作来解决我的问题,我将我的项目与 Gradle 文件同步

I downloaded Java 8 (but I don't think this guy did the work)我下载了 Java 8(但我认为这个人没有完成这项工作)

I encountered this issue because I didn't have Java installed.我遇到了这个问题,因为我没有安装 Java。 If you can't see a Java icon under System Preferences, Java 7 or later versions is not installed.如果在“系统偏好设置”下看不到 Java 图标,则说明未安装 Java 7 或更高版本。 Link to java.com链接到 java.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ./gradlew 操作无法完成。 无法找到 Java 运行时 - ./gradlew The operation couldn’t be completed. Unable to locate a Java Runtime 操作无法完成。 无法找到支持 apt 的 Java 运行时 - The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt Mac 操作无法完成。 找不到支持 jarsigner 的 Java 运行时 - Mac The operation couldn’t be completed. Unable to locate a Java Runtime that supports jarsigner JDK 已安装在 mac 上,但我收到“无法完成操作。无法找到支持 apt 的 Java 运行时。” sudo apt 更新 - JDK is installed on mac but i'm getting "The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt." sudo apt update 无法找到 Java 运行时 - Unable to locate a Java Runtime 无法定位 Java 运行时环境 - Unable to locate Java Runtime Environment 如何解决“需要 Java 8 或更高版本才能运行。 请下载并安装最近的 Java 运行时。” 在 VSCode 中? - How to solve “Java 8 or more recent is required to run. Please download and install a recent Java runtime.” in VSCode? 在运行时释放OS的java内存。 - Release java memory for OS at runtime. 无法找到Java Uno RunTime(jurt)源 - Unable to locate the Java Uno RunTime (jurt) sources 找不到支持 javac 的 Java 运行时 - Unable to locate a Java Runtime that supports javac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM