Home > Mobile >  cordova build cannot agree on Java version
cordova build cannot agree on Java version

Time:02-11

$ cordova build android –release
When JAVA_HOME points to old C:\Program Files\Java\jdk1.8.0_261 - I get:
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
When JAVA_HOME points to new C:\Program Files\Java\jdk-17.0.2 - I get:
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 17.0.2
How do I solve this?

CodePudding user response:

Older versions of cordova-android required Java 8, which was requirements from the parts & versions of Android SDK cordova used. There is a Android SDK / cordova-android version mismatch in your environment.

As of cordova-android@10 (current version at the time of writing), the Java 8 restriction was opened up to allow Java 11 as cordova-android was updated to use more modern versions of the Android SDK which consequentially requires Java 11.

Requirements check failed for JDK 8 ('1.8.*')

Not sure which cordova-android version you're running but this error definitely means you aren't running cordova-android@10, so I'd suggest to update the cordova-android platform.

cordova platform remove android
cordova platform add android@10

I'd also suggest ensuring you're running cordova cli verison 10 or later as well. (Checkable via cordova -v)

CodePudding user response:

You should download the latest version

  • Related