cordova gradle build SUCCESSFUL 然后變成 FAILED。也許版本有問題?中間好像下載了一個較低的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
uj5u.com熱心網友回復:
首次成功構建意味著 gradle 包裝器的成功執行。它的任務是下載 gradle 7.1.1。由于您的 gradle jvm 版本,第二個構建(您要執行的構建)以失敗告終。如果您使用 IntelliJ IDEA,請打開 gradle 設定(這可能在螢屏的左側)或僅打開首選項 > 構建、執行、部署 > 構建工具 > Gradle 并設定 Gradle JVM

uj5u.com熱心網友回復:
經過數小時努力尋找正確的版本后,似乎以下組合似乎成功構建:
科爾多瓦 10.0.0
jdk 11.0.13
Gradle 7.1.1
Android Gradle 插件 4.2.2
還有許多其他問題,在網路上其他討論的幫助下克服了。如果有人感興趣,我會記錄下來。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/427918.html
