Android Platform Guide trouble with adding a platf

2020-08-01 05:31发布

问题:

I am following the installation guide: http://cordova.apache.org/docs/en/3.0.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

As aa early info this is my issue.

C:\apps\hello>cordova platform add android
[Error: An error occured during creation of android sub-project. 
Creating Cordova project for the Android platform:
Command failed to execute : ant jar

This is what i did:

  • I installed all Java Dev packages (everything)
  • I installed Apache ANT, and created the environment variables (they work)
  • I created environment variables for PATH for the adt-bundle

All i want is to

cordova platform add android

cordova emulate android

回答1:

This is due to ANT tools could not find tools.jar in JRE lib directory. When I copied tools.jar from JDK lib directory to JRE lib directory, the problem was absolutely solved and the build was successful when I ran the command "cordova -d platform add android". Hope this helps you.



回答2:

I got the same issue today. upon research I found that I need to install JDK instead of JRE.

Install JDK from this link

After installation, set the JAVA_HOME to C:\Program Files\Java\jdk1.7.0_45 [your JDK Path].

Hope this helps!!



回答3:

I installed the JRE instead of the JDK... Im no expert on Java installations, but this was my error.