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 !

I am having the same problem, and I cannot understand the version series. 1.8 and 15 it seems like theese are independant version numbers, how are they related? I can’t find 1.8 on Oracles page, only 16…

Here.

I don’t get it.
I tried each of these:

jdk-8u281-windows-x64.exe

and

jdk-16_windows-x64_bin.exe

They were the newest I could find, apparently the top one is the RTE.
I tried both but still I get this similar message.
As I learned from your link the Java SE 8 platform could be found in both JDK 8 and JRE8, but I still get this message. I also set the two variables to be C:\Users\Christian\AppData\Local\Android\Sdk, But I don’t think the error message change much.

PS C:\Room> cordova emulate android
(node:18196) ExperimentalWarning: The fs.promises API is experimental
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\Christian\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\Christian\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\Christian\AppData\Local\Android\Sdk
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 13.0.1
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
PS C:\Room>

Now it says Detected version 16, but it still doesn’t work. 16 is the newest afaik…!

Still can’t find any 1.8

installs java|662x395