user3403739
user3403739

Reputation: 91

Phone Gap [error] cmd: Command failed with exit code ENOENT

I am trying to get phone gap to work on android and my command outputs the following:

phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] cmd: Command failed with exit code ENOENT

When searching this error message I get a lot of hits, but everyone else seems to have much more verbose error messages, when this is all I get. Even with the -d or -v option that is what I get.

I am using Windows 7 x64

My PATH variable looks like this:

%JAVA_HOME%\bin;C:\Users\Mike\AppData\Roaming\npm;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%ANT_HOME%\bin;C:\Program Files\nodejs;

%JAVA_HOME% , %ANDROID_HOME% and %ANT_HOME%

all lead to the correct places when I type them into my search bar.

Just typing "java" and "ant" into my command line gives me results.

Any ideas where I should start looking? Are there error logs somewhere?

Upvotes: 9

Views: 41555

Answers (7)

dunet roi
dunet roi

Reputation: 1

Try to delete this folder :

%USERPROFILE%\.gradle

Upvotes: 0

user1738092
user1738092

Reputation: 173

Please add C:\Windows\System32 in your PATH variable. It worked for me!

Upvotes: -1

user495285
user495285

Reputation: 181

I'm using cordova and the following worked for me:

cordova platform rm android
cordova platform add android

After this refresh eclipse acted a bit wonky just remove and add the project back again.

Upvotes: 2

Desmond
Desmond

Reputation: 1368

I am not sure how this resolved the issue but try this out it will resolve for sure.

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. Restart the system and the problem was absolutely solved and the build was successful when I ran the command "cordova -d platform add android". Hope this helps you.

Upvotes: 4

andreibosco
andreibosco

Reputation: 158

He is using Windows 7, brew is for OSX.

To install ANT for windows try this: https://code.google.com/p/winant/

Upvotes: 3

hdmartinez
hdmartinez

Reputation: 352

If you are sure of yours paths try to type android in cmd if it says: 'xcopy' was not recognized.

then add to your path:

%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;

Upvotes: 7

Nurdin
Nurdin

Reputation: 23883

You need to install ant before build.

How to install ant? Use this one.

try this one. Make sure you install node.js first

1.Download and install Homebrew by executing following command in cmd:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

2.Install Apache Ant via Homebrew by executing

brew install ant

3.Build project

phonegap build android

Upvotes: 2

Related Questions