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!
1条答案
按热度按时间erhoui1w1#
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):
/usr/bin/javac
(which might be an alias to another location)./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
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.