Ionic Android Platform Build Fails

Every time I try to build my Android platform on ionic, I am greeted by an error indicating that my JAVA_HOME is invalid, while it points to the correct path, as shown below. I tried to remove and re-add the platform and re-add the paths to the environment variables, but nothing works. I have been trying to fix this error for several days. Please, help!

Entrance:

ionic build android 

Conclusion:

 [Error: Failed to run "java -version", make sure that you have a JDK installed. You can get it from: http://www.oracle.com/technetwork/java/javase/downloads. Your JAVA_HOME is invalid: C:\Program Files\Java\jdk1.7.0_75; ] ERROR building one of the platforms: Error: C:\myApp\platforms\android\cordova\b uild.bat: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: C:\myApp\platforms\android\cordova\build.bat: Command failed with exit co de 2 at ChildProcess.whenDone (C:\Users\com\AppData\Roaming\npm\node_modules\cord ova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Process.ChildProcess._handle.onexit (child_process.js:823:5) 
+5
source share
2 answers

Have you checked if the JAVA_HOME that it refers to exists? Open a command prompt and type: "%Java_home%/bin/java" -version to see what you get. If you get something other than Java version information, you need to check and update the system variable for JAVA_HOME in the Windows environment variables.

0
source

I had a similar problem,

in my case, I installed JAVA_HOME=\Java\jdk1.7.0_45 , and my actual installed version was << 21>.

So, check the installed version of jdk1.7.0_75

0
source

Source: https://habr.com/ru/post/1216126/


All Articles