Android Platform Guide trouble with adding a platf

2020-08-01 05:41发布

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

3条回答
Root(大扎)
2楼-- · 2020-08-01 06:21

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

查看更多
劫难
3楼-- · 2020-08-01 06:24

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!!

查看更多
放荡不羁爱自由
4楼-- · 2020-08-01 06:30

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.

查看更多
登录 后发表回答