问题
I get a ionic project from a person, and I want to debug it in a real android device.
I use this command:
ionic cordova run android --device --verbose
And in the end I get these error messages:
Preparing Firebase on Android
No scripts found for hook "before_compile".
Failed to find 'JAVA_HOME' environment variable. Try setting it manually.
CordovaError: Failed to find 'JAVA_HOME' environment variable. Try setting it manually.
I have JAVA_HOME
set, indeed if I do echo $JAVA_HOME
I get:
/usr/lib/jvm/java-1.11.0-openjdk-amd64
According to Failed to find 'JAVA_HOME' environment variable. Try setting it manually post, I also tried adding bin
folder to JAVA_HOME
variable, without any success.
If I also try java -version
and javac -version
I get success messages.
回答1:
SOLVED
Version 10.0.0 of Cordova requires jdk version 8. That's it.
来源:https://stackoverflow.com/questions/65286857/cordovaerror-failed-to-find-java-home-environment-variable-try-setting-it-ma