Error: Requirements check failed for JDK 1.8 or greater

I checked java -version . Result:
java version "1.7.0_80"
Java™ SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot™ 64-Bit Server VM (build 24.80-b11, mixed mode)
taubancam@(none):/var/www/ionic/ahihi$ javac -version
javac 1.7.0_80
But when I run : cordova build --release android
Error is here => Error: Requirements check failed for JDK 1.8 or greater


Your system information:

Cordova CLI: 6.4.0
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.4
Ionic App Lib Version: 2.1.2
Ionic App Scripts Version: 0.0.36
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS
Node Version: v6.3.1


You need to install the JDK 1.8.

3 Likes

http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/
Thank you so much.I was installed jdk8 by terminal
It is working but then it’s have problem
Error: /var/www/ionic/ahihi/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/var/www/ionic/ahihi/platforms/android/build.gradle’ line: 20

  • What went wrong:
    A problem occurred evaluating root project ‘android’.

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1 Like

That means it’s not actually using Java 1.8. What does it show if you type java -version?

1 Like

I’m also getting the error when running ionic build android

Error: Requirements check failed for JDK 1.8 or greater

I did install the JDK 1.8 via the link provided above, and set my JAVA_HOME to the 1.8 JRE location. I get below when running java -version

java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

java version “1.8.0_111”
Java™ SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot™ 64-Bit Server VM (build 25.111-b14, mixed mode)

Did you set the JAVA_HOME environment variable as mentioned in the Cordova instructions?

Since you’re using the Ubuntu PPA that should be the Configuring Java Environment step of that page. Check if it’s set by typing echo $JAVA_HOME

You need the JDK not the JRE.

1 Like

oh. That right.It’s working. Thank you very much!

One other note that I ran into. I had some parts of my PATH environment variable that were pointing to a 1.7 JDK. I had to swap those over to 1.8 too, then it started to work for me.

1 Like

Well ,I also met the same issue yesterday fixed at last , but some new errors occurred to me . Here is my jdk environment(vi .bash_profile in command ):

export JAVA_HOME=/Library/java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Cordova 6.4.0 depends on java 1.8 ,so we have to update them .Emmm…Cordova 6.4.0 have problem in “splashscreen/SplashScreen.java uses” which will make you android app conclude icon and splash Ionic splash screen will not show in Android on brand new project.

So I think it’s better to use cordova 6.3.1 until cordova fix that issue
(My english is poor , never mind it~:wink:)

1 Like

I’m also in similar situation. I received same error and installed JDK 1.8 , but the error stays.
I applied “java -version” and the response is as follows:
java version "1.8.0_111"
Java ™ SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot ™ Client VM (build 25.111-b14, mixed mode, sharing)

but when I want to execute “ionic build android” in a demo project, I receive same error:
ANDROID_HOME=…
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
Error: Requirements check failed for JDK 1.8 or greater.

I’ve tried to add android platform again, but get the error: android already added…
finally I’m working on a PC with Windows 7 OS.

I would be thankful if anyone tell me, what is wrong with me

I have same situation and error.

I don’t know why I get the error message while I’ve been installed JDK 1.8
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111

what can I do else?

When I want to execute also “ionic emulate android”, I receive exactly the same error

Hi alishokoie,

I have resolved the problem. In my case the problem is that I have many java version installed, I have uninstal all java versions from my windows 10 os then I run CC Cleaner and reboot system then I have install again java sdk 1.8 and restart windows again and now works.

2 Likes

thank you very much danny36 for your tip. It resolved also my problem too. I uninstalled all java versions and installed again JDK 1.8
regards

I had the same problem reinstalled SDK didn’t work removed old sdk and reinstalled SDK did’t work

You need to delete the android folder form the platform folder and execute ionic run android this will reinstall the platform automatically and build from scratch. I think the cache files are the problem so that is why I think this worked.

I hope it will also work for others.

1 Like

This solved my problem. Thanks.

1 Like

Hi,

I resolved this problem by moving up latest version top in PATH. Always you need to refer least version JDK in JAVA_HOME and same path need to be the top in PATH.

No need to do any other changes.

2 Likes

Hi,

when i use ‘ionic run android’ it works fine,

already checked the java ver:
java version "1.8.0_121"
Java™ SE Runtime Environment (build 1.8.0_121-b13)

ANDROID_HOME=C:\Users\user\AppData\Local\Android\sdk

JAVA_HOME=C:\Program Files\java\jdk1.8.0_121

but keeps getting the error when debugging with vs

any idea why?

1 Like