ionic-cli: Requirements check failed for JDK 1.8 or greater
I trying to publish my app but doesnt work
java version
huseyin-MacBook-Pro:city huseyinsolmaz$ 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)
huseyin-MacBook-Pro:city huseyinsolmaz$
ionic info ` huseyin-MacBook-Pro:city huseyinsolmaz$ ionic info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : not installed
Gulp CLI : CLI version 3.9.1 Local version 3.9.1
local packages:
Cordova Platforms : none
Ionic Framework : ionic1 1.3.3
System:
Node : v8.11.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145
Environment Variables:
ANDROID_HOME : /Development/android-sdk/
Misc:
backend : pro
`
` huseyin-MacBook-Pro:city huseyinsolmaz$ sudo ionic cordova build --release android
cordova platform add android --save Using cordova-fetch for cordova-android@7.0.0
Adding android project…
Creating Cordova project for the Android platform:
Path: platforms/android
Package: io.ionic.starter
Name: city
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib Subproject Path: app Android project created with cordova-android@7.0.0
Android Studio project detected
Android Studio project detected
Discovered plugin “cordova-plugin-whitelist” in config.xml. Adding it to the project
Installing “cordova-plugin-whitelist” for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json Saved plugin info for “cordova-plugin-whitelist” to config.xml
Discovered plugin “cordova-plugin-device” in config.xml. Adding it to the project
Installing “cordova-plugin-device” for android
Adding cordova-plugin-device to package.json
Saved plugin info for “cordova-plugin-device” to config.xml
Discovered plugin “cordova-plugin-splashscreen” in config.xml. Adding it to the project
Installing “cordova-plugin-splashscreen” for android
Adding cordova-plugin-splashscreen to package.json
Saved plugin info for “cordova-plugin-splashscreen” to config.xml
Discovered plugin “cordova-plugin-ionic-webview” in config.xml. Adding it to the project
Installing “cordova-plugin-ionic-webview” for android
Adding cordova-plugin-ionic-webview to package.json
Saved plugin info for “cordova-plugin-ionic-webview” to config.xml
Discovered plugin “cordova-plugin-ionic-keyboard” in config.xml. Adding it to the project
Installing “cordova-plugin-ionic-keyboard” for android
Adding cordova-plugin-ionic-keyboard to package.json
Saved plugin info for “cordova-plugin-ionic-keyboard” to config.xml
Running command: /Users/huseyinsolmaz/Sites/city/hooks/after_prepare/010_add_platform_class.js /Users/huseyinsolmaz/Sites/city
–save flag or autosave detected
Saving android@~7.0.0 into config.xml file …
cordova build android --release Android Studio project detected
Running command: /Users/huseyinsolmaz/Sites/city/hooks/after_prepare/010_add_platform_class.js /Users/huseyinsolmaz/Sites/city
ANDROID_HOME=/usr/local/Caskroom/android-sdk/3859397 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home (node:13133) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater at /Users/huseyinsolmaz/Sites/city/platforms/android/cordova/lib/check_reqs.js:370:19 at _fulfilled (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:854:54) at self.promiseDispatch.done (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:883:30) at Promise.promise.promiseDispatch (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:816:13) at /Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:624:44 at runSingle (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:137:13) at flush (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) (node:13133) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:13133) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
`
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 23 (7 by maintainers)
1.Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
2.Purge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):
3.Remove Java config and cache directory:
4.Remove manually installed JVMs:
5.Remove Java entries, if there is still any, from the alternatives:
6.Search for possible remaining Java directories:
7.Install JAVA-8-SDK
8.Open sudo gedit ~/.bashrc and add these lines
Try to run your ionic app again 😃 Njoy!
*** IF YOU GET THIS ERROR ***
This error occurs when building Android projects for Cordova with Java 10. Cordova Android projects still require Java 8. The instructions for installing Java are different per OS.
Here are Cordova’s official instructions: https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#java-development-kit-jdk
There are also plenty of online resources for installing Java 8. Just google something like
"install java 8 mac os"
Same issue on Mac OS, solved by below code:
export JAVA_HOME=$(/usr/libexec/java_home -v1.8)
Im working on a MacOS Mojave. I wasn’t been able to build for android with ionic. What i had to do was the following:
First of all, i had two versions of java. I removed them both, like so:
cd /Library/Java/JavaVirtualMachines
sudo rm -rf jdk<version_number>.jdk
I then went over to https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to download the jdk8 version, because ionic v3 apperently only supports this version.
After installing that i installed gradle because i didn’t had it at that moment:
brew install gradle
An lastly i had to accept the License of the sdk, i could do it via the terminal like so:
~/Library/Android/sdk/tools/bin/sdkmanager --licenses
and proceed the steps.But i opened Android Studio, selected ‘SDK manager’ on the settings wheel at the bottom right corner and checked out the first three version of android (Android 9, 8.1, and 8.0). And proceeded the steps.
I restarted my terminal and ran the following command again:
ionic cordova build android
And it worked! Hope this’ll help.
@dwieeb looks like the version check breaks with new java 10 versioning:
/jdk-10.0.1.jdk
is greater than 1.8I’ve faced this problem, but now fixed, this is how…
I think it just about JDK setting on your ubuntu, make sure you install version 1.8 (manually from tar.gz, because ppa still not work).
then don’t forget to change default java & javac version into 1.8 with this
Thank you @dwieeb i solved this by deleting the java 10 and install the java 8 once again… and i used brew to install the dpkg from the terminal.!
DUDE this is ore pure!, THANKS!!!
Fixed I just do edit ~/.bash_profile
export ANDROID_HOME=/Development/android-sdk/ export PATH=${PATH}:/Development/android-sdk/platform-tools:/Development/android-sdk/tools