ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 302 forks source link

Problems with JDK10 - ionic #1424

Open vsreddy91 opened 6 years ago

vsreddy91 commented 6 years ago

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Short description of the problem:

CordovaError: Requirements check failed for JDK 1.8 or greater

What behavior are you expecting?

APK Creation

ionic cordova run android

which gives me this error,
.......
ANDROID_HOME=C:\Users\dell\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk-10.0.1
(node:2172) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater

Which @ionic/app-scripts version are you using?

ionic/app-scripts : 3.1.9 Cordova Platforms : android 7.0.0 Ionic Framework : ionic-angular 3.9.2 cordova (Cordova CLI) : 8.0.0

ionic/cli-utils : 1.19.2 ionic (Ionic CLI) : 3.20.0

java -version java version "10.0.1" 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

Android SDK Tools : 26.1.1 Node : v8.11.1 npm : 5.6.0 OS : Windows 10

ANDROID_HOME : C:\Users\dell\AppData\Local\Android\Sdk

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

danielsogl commented 6 years ago

Android does not support Java 9/10. This has nothing to do with Ionic or Cordova but with the Android SDK.

vsreddy91 commented 6 years ago

Downgraded the Java version to 1.8, and I can able to build the APK now.

Thanks for the quick response @danielsogl ...!

StoneSILU commented 6 years ago

Hi,

I have the same problem. I have dowgraded to java 8 but still same same error.

JAVA_HOME = /usr/lib/jvm/jdk1.8.0_181

chitholian commented 6 years ago

@danielsogl, But how Android Studio compiles with my Java 10 if android does not support it? Do they include whole JDK ?

rmacuna commented 5 years ago

Having the same problem, Require 1.8. But android studio compiles correctly

leovolpatto commented 5 years ago

Go to /platforms/android/cordova/lib/check_reqs.js and comment the line 370:

//throw new CordovaError('Requirements check failed for JDK 1.8 or greater'); This should do the trick ;)

jigar92 commented 5 years ago

Go to /platforms/android/cordova/lib/check_reqs.js and comment the line 370:

//throw new CordovaError('Requirements check failed for JDK 1.8 or greater'); This should do the trick ;)

@leovolpatto Your trick worked for me even with JDK 10.0.1

SanjanaTailor commented 5 years ago

Go to /platforms/android/cordova/lib/check_reqs.js and comment the line 370:

//throw new CordovaError('Requirements check failed for JDK 1.8 or greater'); This should do the trick ;)

Thank you IT worked like charm !