How to fix Requirements check failed for JDK 8 problem?

Hello,
I’m trying for the first time to publish my project to test it on my smartphone.
When I launch this command: cordova.cmd build android --release --verbose
I finally receive such error messages:

Prepared android project successfully
No scripts found for hook “after_prepare”.
No scripts found for hook “before_compile”.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=D:\Users\mylogin\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=D:\Users\mylogin\AppData\Local\Android\Sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.’)! Detected version: 15*
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

  • at D:\Users\mylogin\myproject\myproject\platforms\android\cordova\lib\check_reqs.js:371:19*
  • at _fulfilled (D:\Users\mylogin\myproject\myproject\platforms\android\cordova\node_modules\q\q.js:854:54)*
  • at D:\Users\mylogin\myproject\myproject\platforms\android\cordova\node_modules\q\q.js:883:30*
  • at Promise.promise.promiseDispatch (D:\Users\mylogin\myproject\myproject\platforms\android\cordova\node_modules\q\q.js:816:13)*
  • at D:\Users\mylogin\myproject\myproject\platforms\android\cordova\node_modules\q\q.js:624:44*
  • at runSingle (D:\Users\mylogin\myproject\myproject\platforms\android\cordova\node_modules\q\q.js:137:13)*
  • at flush (D:\Users\mylogin\myproject\myproject\platforms\android\cordova\node_modules\q\q.js:125:13)*
  • at processTicksAndRejections (internal/process/task_queues.js:76:11)*
    [ERROR] An error occurred while running subprocess cordova.
    cordova.cmd build android --release --verbose exited with exit code 1.

It’s complaining about “Requirements check failed for JDK 8 ('1.8.’)! Detected version: 15”.
I checked the check_req.js that is managing this check and indeed the check is hard coded on 1.8… but the current version is 15… How to fix that please?

    if (!String(values[0]).startsWith('1.8.')) {
        throw new CordovaError(
            'Requirements check failed for JDK 8 (\'1.8.*\')! Detected version: ' + values[0] + '\n' +
            'Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.'
        );
    }

Your need change the JAVA for the 1.8 JDK, you current version is 15.
Just the version 1.8 work

Remove the 15 version and install 1.8 JDK

See the link

1 Like

Thanks a lot ! It worked !