Ionic-app-scripts: Problems with JDK10 - ionic

Created on 27 Apr 2018  路  8Comments  路  Source: ionic-team/ionic-app-scripts

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:\Usersdell\AppData\Local\Android\Sdk

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

Most helpful comment

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 ;)

All 8 comments

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

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

Thanks for the quick response @danielsogl ...!

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

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

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

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 ;)

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

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 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danbucholtz picture danbucholtz  路  4Comments

isflo96 picture isflo96  路  3Comments

MarkErik picture MarkErik  路  3Comments

christofferjjohansen picture christofferjjohansen  路  3Comments

barbsicle picture barbsicle  路  3Comments