Skip to content
Advertisement

cordova gradle build SUCCESSFUL turns into FAILED

cordova gradle build SUCCESSFUL and then turns into FAILED. Maybe something is wrong with the versions? It seems to download a lower gradle version in the middle… why?

Starting with versions: Gradle 7.3.3, Cordova 10.0.0, Java/JDK 17.0.2 – Here is the transcript (leaving only the main things):

C:MYAPPProject>cordova build android –release
(node:10944) ExperimentalWarning: The fs.promises API is experimental
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:UsersUSERAppDataLocalAndroidSdk (recommended setting)
ANDROID_HOME=C:UsersUSERAppDataLocalAndroidSdk (DEPRECATED)
Using Android SDK: C:UsersUSERAppDataLocalAndroidSdk
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:MYAPPProjectplatformsandroidsettings.gradle'

What went wrong:
Could not compile settings file 'C:MYAPPProjectplatformsandroidsettings.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:MYAPPProjectplatformsandroidgradlew :app:bundleRelease -b C:MYAPPProjectplatformsandroidbuild.gradle

Advertisement

Answer

After struggling for hours to find the correct versions, it appears that the following combination seems to build successfully:

cordova 10.0.0
jdk 11.0.13
Gradle 7.1.1
Android Gradle Plugin 4.2.2

There were many other problems, overcome with the help of other discussions on the web. I kept a record of them, if anyone is interested.

Advertisement