简体   繁体   中英

Error: Requirements check failed for JDK 1.8 or greater on Ionic

I have an Ionic app which started to fail when I run:

ionic cordova run android --consolelogs --device --livereload

I get this error:

ANDROID_HOME=/home/ivan/Android
JAVA_HOME=/usr/lib/jvm/java-10-oracle/
Error: Requirements check failed for JDK 1.8 or greater

My environment variables are:

echo $JAVA_HOME
/usr/lib/jvm/java-10-oracle/

echo $ANDROID_HOME
/home/ivan/Android

My current versions:

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

javac -version
javac 10.0.2

Ionic info:

cli packages: (/usr/lib/node_modules)

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

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.0.2
    Node              : v6.14.3
    npm               : 4.6.1 
    OS                : Linux 4.4

Environment Variables:

    ANDROID_HOME : /home/ivan/Android

Misc:

    backend : legacy

I don't know what's happening here. Any ideas?

Thank's in advance!

Well, I solved this issue with the following steps:

I had the v10 of java's sdk. So I downgraded to v8.

  • Uninstall my jdk with: sudo apt-get remove oracle-java10-installer

  • Follow this steps to install v8.

  • Restored my global installation of cordova. It was in 8.0.0 and I restored it to 7.0.1 with the command: sudo npm install -g cordova@7.0.1 .

  • I restored my "cordova-android": to "^6.4.0" (in my app),

  • Deleted all the plugins in confix.xml.

  • Deleted android platform: ionic cordova platform remove android .

  • Remove dependencies and plugins: rm -rf /node_modules /plugins .

  • Add android platform again: ionic cordova platform add android .

  • Then run on device: ionic cordova run android --consolelogs --device --livereload .

安装Java JDK 1.8,在使用以下命令导出JAVA_HOME = /usr/libexec/java_home -v 1.8之前运行此命令

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM