'Java 11 requirements check failed for JDK 1.8 or greater with Cordova
When I run ````cordova run android``` in the path of my project I get
Android Studio project detected
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to /path/to/platforms/android/app/build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to /path/to/cordova-android-support-gradle-release/norsan-cordova-android-support-gradle-release.gradle
ANDROID_HOME=/usr/lib/android-sdk
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
Requirements check failed for JDK 1.8 or greater
My version of Java
$ java --version
openjdk 11.0.5 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.119.04)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.119.04, mixed mode, sharing)
My version of javac
$ javac --version
javac 11.0.5
My version of Cordova
$ cordova --version
9.0.0 ([email protected])
My version of Node
$ node --version
v10.15.2
My version of Nodejs
$ nodejs --version
v10.15.2
My version of NPM
$ npm --version
5.8.0
My version of Gradle
$ gradle -version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/java/groovy-all.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------
Build time: 2012-12-21 00:00:00 UTC
Revision: none
Groovy: 2.4.16
Ant: Apache Ant(TM) version 1.10.5 compiled on March 28 2019
JVM: 11.0.5 (Private Build 11.0.5+10-post-Ubuntu-0ubuntu1.119.04)
OS: Linux 5.0.0-38-generic amd64
I found that android-studio --version
didn't do anything but silently wait, but when I open the program through the graphical user interface I see that the version is 3.6.1.
My version of androidsdk is Unknown... Not sure why.
$ androidsdk --version
SDK_ROOT=/home/galen/snap/androidsdk/21/AndroidSDK
Picked up _JAVA_OPTIONS: -Duser.home=/home/galen/snap/androidsdk/21
Unknown version
My version of Ubuntu
$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.04
DISTRIB_CODENAME=disco
DISTRIB_DESCRIPTION="Ubuntu 19.04"
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco
My understanding is that Java 11 comes later than JDK 1.8, so why does the requirements check fail? And, how do I fix this requirements check failure?
Solution 1:[1]
The problem here is that the command does not respect JAVA_HOME variable (you need to set this to Java 8 as well)
As someone already mentioned, the bump from 8 to 11 is massive. Many libraries that were in Java 8 are moved out in Java 11, so while Java itself is backward compatible, the included libraries are not.
What works for me is to set JAVA_HOME to JDK8
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
AND I need to configure system wide java and javac settings with commands
sudo update-alternatives --config java
sudo update-alternatives --config javac
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Shmarkus |