离子Cordova运行Android和Java版本
因此,我基本上是在尝试在Android设备上运行我的离子应用程序,并且命令“ Ionic Cordova Run Android - 设备”到了告诉我出现错误的原因是:
Requirements check failed for JDK 1.8.x! Detected version: 16.0.0
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
因此,在验证我拥有的Java版本之后,成功将版本更改为1.8.x,因此当我运行Java -version时,它会返回:
java version "1.8.0_251"
但是,运行“ Ionic Cordova运行Android - 设备”,它返回相同的原始错误:
Requirements check failed for JDK 1.8.x! Detected version: 16.0.0
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
经过更多的研究,我意识到,我意识到它的Javac版本告诉我另一个版本,我相信它必须相同。因此,当我运行“ Javac -version”时,我会得到:
javac 16
所以...我不知道如何将Javac版本更改为与Java相同,我唯一认为它可能是有路径的东西,但是主题有些混乱,因为我不确定下一步该怎么做?
我在.zshrc文件中有以下内容:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
我添加了用于修复原始Java版本的问题,但这似乎也没有更改Javac。
因此,在运行命令“哪个Java”和“哪个Javac”之后,我得到了:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
/usr/bin/javac
我认为这里有一些有趣的东西,对吗?但这基本上是我卡住的地方。我什至不确定这是否是问题,但这是我认为我只是在做一些愚蠢的事情而没有意识到这一点,
大声笑了任何帮助!
so I'm basically trying to run my ionic app on an android device, and the command "ionic cordova run android --device" get as far as telling me an error occurred due to:
Requirements check failed for JDK 1.8.x! Detected version: 16.0.0
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
So, after verifying which java versions I had and successfully changing the version to a 1.8.X, so when I run java -version, it returns:
java version "1.8.0_251"
However, running "ionic cordova run android --device" again, it returns the same original error:
Requirements check failed for JDK 1.8.x! Detected version: 16.0.0
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
After some more research, I realized that the javac version of it, tells me another version, and it needs to be same I believe. So when I run "javac -version", I get:
javac 16
So... I couldn't figure out how to change the javac version to be the same as java, the only thing I figure is that it could be something with PATH, but the topics get a bit confusing as I'm not sure what to do next?
I have in my .zshrc file the following:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Which I added to fix the original java version issue, but that didn't seem to have changed the javac as well.
So after running the commands "which java" and "which javac" respectively, I get:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
/usr/bin/javac
I assume there's something funny in here, huh? But this is basically where I'm stuck. I'm not even sure if this is the issue, but it's one of those things I think I'm just doing something stupid without realising it lol
Any help is greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目标
您描述的是您想要“ Java”和“ Javac”才能解决JDK 1.8。从那里,您将可以使用离子Cordova做事。
起点
是您运行的各种命令,以及它们的输出(我更改了格式,使其看起来像正在运行的实际命令,并且输出):
java编译器(“ Javac”)适用于JDK 16,并且生活在
/usr/bin/javac
(可能是另一个位置的别名)。java运行时 - 启动Java虚拟机的东西 - 在其他地方解决
总共 -
/Library/Internet Plug-ins /... - 并以1.8版而不是16:
显示
外卖。
fix
install jdk 1.8 - 这将为您提供一个编译器和运行时。
有多种设置Java_home并管理多个JDK安装的方法 - 这是超越您所面临的问题的最简单方法:手动设置Java_home。这将取决于系统,但以下是我本地系统的一个示例。
验证“ Java”解决您的新1.8安装:
验证“ Javac”也可以解决您的新1.8安装:
如果您看到以上其他任何内容,其他事情正在进行,我们将需要查看更多详细信息,包括从上述步骤中进行的任何输出。
Goal
You are describing that you want "java" and "javac" to both resolve to JDK 1.8. From there, you'll be able to use ionic cordova to do things.
Starting point
Here are various commands you've run, along with their output (I changed format to make it look like actual commands being run, and the output):
Java compiler ("javac") is for JDK 16, and lives at
/usr/bin/javac
(which might be an alias to another location).Java runtime – the thing which starts the Java Virtual Machine – is resolving somewhere else
altogether –
/Library/Internet Plug-Ins/...
– and shows up as version 1.8, not 16:A few takeaways..
/usr/bin
Fix
Install JDK 1.8 – this will give you a compiler and runtime that are both version 1.8
Follow download steps here: https://www.oracle.com/java/technologies/downloads/#java8 Once installed, you should be able to switch to using JDK 1.8, and confirm versions of both the compiler (javac) and the runtime (java) binaries.
There are various ways to set JAVA_HOME and manage multiple JDK installs – this is the simplest way to just get past the issue you're facing: set JAVA_HOME manually. This will be system dependent, but below is an example from my local system.
Verify that "java" resolves to your new 1.8 install:
Verify that "javac" also resolves to your new 1.8 install:
If you see anything other than above, something else is going on, and we would need to see more details, including whatever output happened from following the above steps.