Cant resolve PATH issue in Cordova

2

Hi i'm trying to build an app in Cordova yet i have hit a road block. Can someone please help me with pointing everything to the right PATH.

I run the following commands no problem.

cordova create studioproject online.cbradio studioproject
cordova platforms/add android
cordova platform add android
cordova prepare android

Then i run into problems....

john@john-Inspiron-3531:~/cordova/studioproject$ cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/john/Android/Sdk (recommended setting)
ANDROID_HOME=/home/john/Android/Sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.3
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

OK so I have installed the SDK

john@john-Inspiron-3531:~/cordova/studioproject$ cd /home/john/Android/Sdk
john@john-Inspiron-3531:~/Android/Sdk$ ls
build-tools  fonts     patcher   platforms       skins          tools
emulator     licenses  platform  platform-tools  system-images
john@john-Inspiron-3531:~/Android/Sdk$ echo $ANDROID_SDK_ROOT 
/home/john/Android/Sdk

The output of installed jdk

john@john-Inspiron-3531:~/Android/Sdk$ sudo update-java-alternatives --list
java-1.11.0-openjdk-amd64      1111       /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64

I seem to have met the requirements. And also...

john@john-Inspiron-3531:~/Android/Sdk$ echo $JAVA_HOME 
/usr/lib/jvm/java-1.8.0-openjdk-amd64

I am sure everything is in place yet i am getting nowhere. What am i missing? Thanks.

john moore

Posted 2019-08-01T16:20:48.003

Reputation: 21

Answers

1

I used to have the same issue in WebStorm and found solution. The issue is due to WebStorm being written in Java and using v11.0.3 inside. So, do the following:

  1. Open WebstormHelpFind actionSwitch boot JDK → Change the path to your v.1.8. In my case it's: C:\Program Files\Java\jdk1.8.0_231
  2. add JDK_HOME in environment variables in your OS and set it's value to: C:\Program Files\Java\jdk1.8.0_231
  3. Restart your WebStorm.

This also might be helpful.

Roman Tikhomirov

Posted 2019-08-01T16:20:48.003

Reputation: 11

0

I had the same error.

The problem was that I always executed it from within my IDE and Webstorm or any other JetBrains. IDE doesn't use the JAVA_HOME JDK in its terminal but the version it started with.

So, simple solution, use an external command-line.

Alexander

Posted 2019-08-01T16:20:48.003

Reputation: 1

I'm using an external command line and the problem is still here – CrsCaballero – 2019-10-09T23:53:18.497