gpt4 book ai didi

java - 提供的 javaHome 似乎无效。我找不到 java 可执行文件。尝试位置 : C:\Program Files\Java\jdk-17\bin\java. exe

转载 作者:行者123 更新时间:2023-12-05 00:14:52 25 4
gpt4 key购买 nike

我已经为此拉头发3天了,
每次我运行命令 react-native run-android我收到此错误:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:10284) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 871 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17\bin\java.exe

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17\bin\java.exe

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

at makeError (C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\execa\index.js:174:9)
at C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
at async Command.handleAction (C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:192:9)info Run CLI with --verbose flag for more details.
我使用基本 react-native init projectTesting 创建了我的目录
我的 gradle 是 6.9 版 .\android\gradle\wrapper\gradle-wrapper.properties => distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip我的安卓工作室版本是 Android Studio 2020.3.1我的java版本是15
C:\Users\username>java -version
java version "15" 2020-09-15
Java(TM) SE Runtime Environment (build 15+36-1562)
Java HotSpot(TM) 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)

C:\Users\username>javac -version
javac 15
我正在考虑使用 java 17 但在 compatibility docs它说:

A Java version between 8 and 15 is required to execute Gradle. Java 16and later versions are not yet supported when executing Gradle.


任何帮助都将是真正的 真的赞赏!!

最佳答案

删除 Java17 SDK 和 C:\Program Files\Java 文件夹对我有用。使用 openjdk11 代替 Java17 SDK

关于java - 提供的 javaHome 似乎无效。我找不到 java 可执行文件。尝试位置 : C:\Program Files\Java\jdk-17\bin\java. exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69448462/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com