Reputation: 549
I'm trying to run ionic cordova build android
on Ubuntu and get the following error:
You have been opted out of telemetry. To change this, run: cordova telemetry on.
ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Error: Requirements check failed for JDK 1.8 or greater
As you can see, JAVA_HOME is pointing to JDK 8.
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
Here's the output of ionic info
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 2.0.2
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.5.3
System:
Node : v8.2.1
OS : Linux 4.4
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 5.3.0
What am I missing?
EDIT
After installing oracle jdk, I'm still getting the same error.
You have been opted out of telemetry. To change this, run: cordova telemetry on.
ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/java-1.8.0-oracle
Error: Requirements check failed for JDK 1.8 or greater
$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-oracle
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Upvotes: 1
Views: 754
Reputation: 549
/usr/bin/javac was pointing to jdk 7. Changed it to point to the OpenJDK version 8 with the command sudo update-alternatives --config javac
and all is good. I am now able to build it - even with the OpenJDK 8 java so no need to install oracle jdk.
Upvotes: 2