简体   繁体   中英

JDK version error when building android app cordova

Im trying to convert angular appliacation to an apk using cordova. When running

cordova build android

I get the following error

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/mohit/Android/Sdk (recommended setting)
ANDROID_HOME=/home/mohit/Android/Sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.7
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

Running command:

java --version 


openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)

 sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_version/bin/java
update-alternatives: error: alternative /usr/lib/jvm/jdk1.8.0_version/bin/java for java not registered; not setting

It's because you use OpenJDK where cordova requires Oracle JavaJDK. Version numbers do not match. Install Oracle JDK.

https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html

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