Unable to build APK using cordova

The error thrown during the build is as follows:

[cordova]
[cordova] FAILURE: Build failed with an exception.
[cordova]
[cordova] * What went wrong:
[cordova] Could not open settings generic class cache for settings file ‘F:\MVP\Official\Nabard\TestCordova\platforms\android\settings.gradle’ (C:\Users\Lenovo.gradle\caches\7.6\scripts\dqjrgsw17c62wbpoagod92e1e).
[cordova] > BUG! exception in phase ‘semantic analysis’ in source unit ‘BuildScript’ Unsupported class file major version 64
[cordova]
[cordova] * Try:
[cordova] > Run with --stacktrace option to get the stack trace.
[cordova] > Run with --info or --debug option to get more log output.
[cordova] > Run with --scan to get full insights.
[cordova]
[cordova] * Get more help at https://help.gradle.org
[cordova]
[cordova] BUILD FAILED in 696ms
[cordova] Command failed with exit code 1: F:\MVP\Official\Nabard\TestCordova\platforms\android\gradlew -b F:\MVP\Official\Nabard\TestCordova\platforms\android\build.gradle cdvBuildDebug
[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android exited with exit code 1.

What’s your java version?
That error seems to appear when using JAVA 20, but cordova works best with JAVA 11