cordova gradle build SUCCESSFUL 变成 FAILED

cordova gradle build SUCCESSFUL turns into FAILED

cordova gradle 构建成功,然后变为失败。也许版本有问题?中间好像下载了一个较低的gradle版本...为什么?

从以下版本开始:Gradle 7.3.3,Cordova 10.0.0,Java/JDK 17.0.2 - 这是成绩单(只留下主要内容):

C:\MYAPP\Project>cordova build android –release
(node:10944) ExperimentalWarning: The fs.promises API is experimental
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\USER\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\USER\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\USER\AppData\Local\Android\Sdk
Starting a Gradle Daemon (subsequent builds will be faster)

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 9s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip

Welcome to Gradle 7.1.1!

Here are the highlights of this release:
Faster incremental Java compilation
Easier source set configuration in the Kotlin DSL

For more details see https://docs.gradle.org/7.1.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

Where:
Settings file 'C:\MYAPP\Project\platforms\android\settings.gradle'

What went wrong:
Could not compile settings file 'C:\MYAPP\Project\platforms\android\settings.gradle'.
startup failed:  
General error during conversion: Unsupported class file major version 61

java.lang.IllegalArgumentException: Unsupported class file major version 61
[LONG LIST OF LOCATIONS]

1 error

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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 36s
Command failed with exit code 1: C:\MYAPP\Project\platforms\android\gradlew :app:bundleRelease -b C:\MYAPP\Project\platforms\android\build.gradle

首次成功构建意味着成功执行 gradle 包装器。它的任务是下载 gradle 7.1.1。由于您的 gradle jvm 版本,第二个构建(您要执行的构建)以失败告终。如果您使用的是 IntelliJ IDEA,请打开 gradle 设置(这可能位于屏幕左侧)或打开首选项 > 构建、执行、部署 > 构建工具 > Gradle 并设置 Gradle 虚拟机

经过数小时的努力寻找正确的版本后,似乎以下组合似乎已成功构建:

科尔多瓦 10.0.0
jdk11.0.13
Gradle7.1.1
Android Gradle 插件 4.2.2

许多其他问题,在网络上其他讨论的帮助下克服了。我把它们记录下来,如果有人感兴趣的话。