9

I'm trying to do phonegap build android and I have this message :

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
   [error] An error occured during creation of android sub-project. Path not found

Phonegap is looking for "C:\Documents and Settings\corbg\.cordova\lib\android\cordova\3.0.0\bin\create". There is nothing under the directory "3.0.0". I installed cordova like this npm install -g cordova.

I have the some problem when I run cordova platform add android.

Did I missing something?

Vipassana Vijayarangan
  • 8,799
  • 2
  • 17
  • 20
Dougui
  • 7,142
  • 7
  • 52
  • 87

8 Answers8

11

In Windows machine you have to delete .cordova directory under C:\Users\user_name\

Vipul R
  • 195
  • 2
  • 9
8

I have face the same issue, then i corrected my application path, afterthat it is worked out for me.

If you are using win 7 then add the Android ADK path in open the mycomputer -> Properties -> Change Settings-> Advanced -> Environment Variable -> User variable for ....-> path add the Android ADK path here like as following

C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\tools; C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\platform-tools

also add JAVA_HOME and ANT_HOME. - Abdul Jabbar

user3068694
  • 81
  • 1
  • 1
6

Did you set your PATH variable? Sometimes this error occurs in Windows when the PATH variable is not set correctly to access "java" and "ant" exes. If you want to test if they are correctly set, you can simply execute both (from any folder in your command line):

> java

or

> ant

and both programs should be found.

jsidera
  • 1,791
  • 1
  • 17
  • 19
4

It was a problem with my proxy. Cordova create a .cordova directory and try to download something on the internet. The download did not work. Next time, it check if there is a .cordova directory. It don't try to redownload something because the directory exist and it show the error.

I removed the .cordova directory and I solved my problems with proxy. Now, everythings works.

Dougui
  • 7,142
  • 7
  • 52
  • 87
3

What solved the issue for me was having 2 directories on my PATH, the android platform-tools and tools. In my pc those folders were at C:\Program Files (x86)\Android\android-sdk\tools C:\Program Files (x86)\Android\android-sdk\platform-tools

Also make sure you have the following environment variables

  • JAVA_HOME (C:\Program Files\Java\jdk1.7.0_51)
  • ANT_HOME (C:\Program Files\apache\apache-ant-1.9.3)
  • ANDROID_HOME (C:\Program Files (x86)\Android\android-sdk\platform-tools)

I removed the .cordova folder under my user folder but I'm not quite sure if that helped as well.

These links may help you

Community
  • 1
  • 1
Jonathan Morales Vélez
  • 3,030
  • 2
  • 30
  • 43
  • Adding those three environment variables worked for me. ...thanks for pointing out @Jonathan – iuq Feb 13 '14 at 04:55
  • JAVA_HOME and ANT_HOME worked for me. My Java was set to the JRE. I had to change JAVA_HOME to point to the JDK folder. The tools.jar is only found in JDK and is needed to build with Ant. – mbokil Feb 17 '14 at 19:32
  • A Stupid typeo!! But thank you for at least reminding me I was stupid! – Jamie Hutber Feb 25 '14 at 23:49
2

I had the exact same problem for a different reason. I had an old version of ant (1.7.1). At least version 1.8.2 is needed for the build to work.

David
  • 21
  • 1
0

This is because you haven't installed ANT! download it from here and install it step by step https://ant.apache.org/manual/install.html

Then running the last command it will install the dependencies needed.

germ13
  • 532
  • 1
  • 5
  • 12
azerafati
  • 18,215
  • 7
  • 67
  • 72
0

its either due to improper installation or no installation of ANT or JAVA. But moreover we need to add Android SDk and prepare Android Targets via SDK manager before going through this.