cordova gradle构建成功变为失败

yrdbyhpb  于 2022-11-15  发布在  其他
关注(0)|答案(2)|浏览(236)

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
w8ntj3qf

w8ntj3qf1#

经过几个小时的努力寻找正确的版本,下面的组合似乎构建成功:
cordova 10.0.0
数据库11.0.13
分级7.1.1
Android Gradle插件4.2.2
还有许多其他的问题,在网上其他讨论的帮助下克服了。我保留了他们的记录,如果有人感兴趣的话。

xv8emn3q

xv8emn3q2#

第一次成功构建意味着成功执行gradle Package 器。其任务是下载gradle 7.1.1。第二次构建(您要执行的构建)以失败结束,原因是您的gradle JVM版本。如果您使用的是IntelliJ IDEA,请打开gradle设置(这可能位于屏幕的左侧)或打开首选项〉构建、执行、部署〉构建工具〉Gradle,然后将Gradle JVM

设置为

相关问题