oxr463/setup-cordova

Requirements check failed for JDK 1.8.x

richorama opened this issue · 6 comments

Hi, I have stared getting this error in my build:

Adding cordova-plugin-local-notification to package.json
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/opt/android-sdk-linux (recommended setting)
ANDROID_HOME=/opt/android-sdk-linux (DEPRECATED)
Requirements check failed for JDK 1.8.x! Detected version: 11.0.11
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

Any idea how I can fix this?

Hi @richorama, sounds like this might be your problem:

The Docker image used for this action is on Java 11. I'll try to see if I can find a work around.

@richorama can you upgrade your Cordova version?

@oxr463 thanks for taking the time to look into this. I'm currently on cordova-android 9.1.0. I'll try bumping up to 10.0.1.

upgraded to 10.0.1 - still no luck.

...
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/opt/android-sdk-linux (recommended setting)
ANDROID_HOME=/opt/android-sdk-linux (DEPRECATED)
Requirements check failed for JDK 1.8.x! Detected version: 11.0.11
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

The env variables are:

ANDROID_SDK_ROOT  = /opt/android-sdk-linux
JAVA_HOME  = /usr/lib/jvm/java-11-openjdk
PATH  = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

This is also failing in the GitHub Actions for this repository.

faelv commented

I'm facing the same problem, running

cordova build android

with cordova-android 9.1.0 gives

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/rafael/Programs/android-sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Requirements check failed for JDK 1.8.x! Detected version: 11.0.11
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

I tried with cordova-android 10.1.1 but after adding it I got the following warning. Can I ignore this warning? I'm new to cordova.

Plugin doesn't support this project's cordova-android version. cordova-android: 10.1.1, failed version requirement: >=4.0.0 <10.0.0
Skipping 'cordova-plugin-whitelist' for android

Running build with cordova-android 10.1.1

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/rafael/Programs/android-sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: /home/rafael/Programs/android-sdk
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.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 7s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip

Exception in thread "main" javax.net.ssl.SSLException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:133)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:349)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:292)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:287)
        at java.base/sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1591)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:453)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411)
        at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
        at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
        at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
        at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:100)
        at org.gradle.wrapper.Download.download(Download.java:80)
        at org.gradle.wrapper.Install$1.call(Install.java:68)
        at org.gradle.wrapper.Install$1.call(Install.java:48)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
        at org.gradle.wrapper.Install.createDist(Install.java:48)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
        at java.base/sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:102)
        at java.base/sun.security.validator.Validator.getInstance(Validator.java:181)
        at java.base/sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:300)
        at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:176)
        at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:189)
        at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
        at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:638)
        at java.base/sun.security.ssl.CertificateStatus$CertificateStatusConsumer.consume(CertificateStatus.java:295)
        at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
        at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:443)
        at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421)
        at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
        at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:171)
        at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1418)
        at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1324)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
        ... 14 more
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
        at java.base/java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
        at java.base/java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120)
        at java.base/java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104)
        at java.base/sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:99)
        ... 29 more
Command failed with exit code 1: /mnt/Files/Projects/cdvtest/platforms/android/gradlew cdvBuildDebug -b /mnt/Files/Projects/cdvtest/platforms/android/build.gradle

Is it ok? 🤔

More info

$ cordova --version
10.0.0

$ gradle --version
------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------

Build time:   2021-08-17 09:59:03 UTC
Revision:     a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin:       1.5.21
Groovy:       3.0.8
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.11 (Ubuntu 11.0.11+9-Ubuntu-0ubuntu2.16.04)
OS:           Linux 4.15.0-65-generic amd64

$ java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.16.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.16.04, mixed mode, sharing)

Same thing happens with cordova 9.0.0 and cordova-android 8.1.0

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/rafael/Programs/android-sdk (recommended setting)
ANDROID_HOME=/home/rafael/Programs/android-sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.11
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.