JDK 8的需求检查失败

时间:2019-06-13 23:55:19

标签: cordova java-8

我已经在Cordova产品上安装了JDK 8。 当我运行yum安装java-1.8.0-openjdk时,我得到了:

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.lysator.liu.se
 * epel: ftp.lysator.liu.se
 * extras: ftp.lysator.liu.se
 * remi-php55: remi.schlundtech.de
 * remi-php56: remi.schlundtech.de
 * remi-php72: remi.schlundtech.de
 * remi-safe: remi.schlundtech.de
 * updates: ftp.lysator.liu.se
Package 1:java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64 already installed and latest version
Nothing to do

我的Java版本是:

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

当我运行时:Alternatives --config java 有2个提供Java的程序。

  Selection    Command
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java)
   2           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.3.7-0.el7_6.x86_64/bin/java)

在我的bash_profile中:

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

所以这里一切都很好。

但是当我运行cordova运行android时,我得到了:

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

我真的需要帮助。

UPPDATE: 现在我试试这个:

javac版本:javac 11.0.3

$ JAVA_HOME,备选方案--config java

bash: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java,: No such file or directory

cordova构建android

config file undefined requested for changes not found at /home/Desktop/freetocollect/platforms/android/undefined, ignoring
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/home/Android/Sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.3
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

UPPDATE 2

现在我已经尝试以正确的方式做到这一点。

回显$ JAVA_HOME

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

哪个java

/usr/bin/java

java -version

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

替代方案--config java

*+ 2 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java)

当我执行cordova要求时,我得到了:

Android的需求检查结果: Java JDK:未安装 无法运行“ javac -version”,请确保已安装JDK版本8。 您可以从以下位置获取它: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

您的JAVA_HOME无效:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java Android SDK:安装正确 Android目标:未安装 avdmanager:命令失败,退出代码为1 摇篮:未安装 在Android Studio中都找不到Gradle的已安装版本, 或在系统上安装gradle包装器。请包括gradle 在您的路径中,或安装Android Studio

ios的需求检查结果: 苹果macOS:未安装 适用于iOS的Cordova工具需要Apple macOS 某些需求检查失败

请帮助。

更新20/6

我键入命令:

ls -l /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

路径正确。

然后我输入:

update-alternatives --set java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

然后我无法创建/var/lib/alternatives/java.new:权限被拒绝

所以我在代码之前使用sudo运行它,并且我认为它可行。没有错误。

当我键入cordova android build时,我得到:

config file undefined requested for changes not found at /home/platforms/android/undefined, ignoring
Failed to run "javac -version", make sure that you have a JDK version 8 installed.
You can get it from the following location:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Your JAVA_HOME is invalid: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

我现在不该做什么。

更新

现在,当我运行cordova要求时,我已经设法解决了一些错误:

Android target: not installed 
avdmanager: Command failed with exit code 1
Gradle: not installed 
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle 
in your path, or install Android Studio

Requirements check results for ios:
Apple macOS: not installed 
Cordova tooling for iOS requires Apple macOS

现在到下一个错误。

更新:21/6

我已经修复了一些错误,但屁股仍然有som。 播种,现在我不知道如何解决它们。

$ cordova build android
config file undefined requested for changes not found at /home/xxxxxxxxx/platforms/android/undefined, ignoring
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/home/xxxxxxxxx/Android/Sdk (DEPRECATED)

ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

/opt/gradle/gradle-5.1/bin/gradle: Command failed with exit code 1

0 个答案:

没有答案