1

Hello I am running a cordova project on my device cordova run android --device console shows me in following error:

ANDROID_HOME=/home/diana/Android/sdk JAVA_HOME=/usr/lib/jvm/java-8-oracle Requirements check failed for JDK 1.8 or greater

However, react native runs perfectly in both Android emulator and mobile device

How can I correct this error? The jdk version is the one that shows me the $java -version command below:

java version "11.0.2" 2019-01-15 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

Rmahajan
  • 1,311
  • 1
  • 14
  • 23
Diana
  • 183
  • 3
  • 16
  • 1
    I think `java version "11.0.2"` is probably not coming from your `java-8-oracle` directory. Try running `which java` to see where it's coming from, and consider pointing JAVA_HOME there. – mkasberg Mar 29 '19 at 21:47
  • Thank you @mkasberg, This is the result of running $ which java: /usr/bin/java How can I correct this? – Diana Mar 29 '19 at 21:52
  • 2
    check possible solutions here.. https://stackoverflow.com/questions/40628240/cordova-requirements-check-failed-for-jdk-1-8-or-greater/46071520 – Masoom Badi Mar 29 '19 at 21:53
  • I have reviewed the link that you showed me @Sam but I am afraid to uninstall the SDK, My computer is Ubuntu and it was an odyssey to install it all to create APP with React Native. It takes 15 days to install the JDK, SDK, etc. – Diana Mar 29 '19 at 22:30
  • 1
    Installing a JDK in Ubuntu should be as simple as `sudo apt-get install openjdk-8-jdk`, unless you have specific requirements to use a build from Oracle. And even in that case, a similar command should work after adding the webupd8 oracle java repository. – mkasberg Apr 02 '19 at 14:17
  • 1
    Also, you might be able to fix the problem without uninstalling if you run `update-java-alternatives`. It's a command that can help you select which version of java the system should use. See here: https://askubuntu.com/questions/315646/update-java-alternatives-vs-update-alternatives-config-java – mkasberg Apr 02 '19 at 14:18

0 Answers0