Home » Android » Installing Phonegap on Windows 7 : The command 'android' failed

Installing Phonegap on Windows 7 : The command 'android' failed

Posted by: admin May 14, 2020 Leave a comment


I followed the documentation and some tutorials on Phonegap to install it on Windows 7, but I’m stuck.

So far, I’ve installed Java 1.7.0_06, Ant-Apache 1.9.2, Eclipse, Android SDK with Android 4.3 (API 18), all Tools and all Extras in the SDK Manager), NodeJS 0.10.18 and Git.

I wrote all paths in the PATH variables in Windows it’s look like this (decomposed) :

C:\Program Files (x86)\Git\bin

Where %JAVA_HOME% and %ANT_HOME% have the right path, they give me the their version when I type java -version or ant -version in the CLI

So I went in the CLI, I installed Phonegap with the following command :

npm install -g phonegap

It give me the 3.0.0-0.14.3 version when I type phonegap -v.

Now, I went to my folder F:\apps and I created a new project with the following command :

phonegap create hello com.example.hello HelloWorld

Everything goes well, the files are created.

I went in the ‘hello’ folder, and I typed this command :

phonegap local build android

And there come the problem, I get this error :

[phonegap] adding the Android platform...
[error] The command `android` failed. Make sure you have the latest AndroidSDK installed, and the `android` command (inside the tools/ folder) added to your path. Output:

I tried this command too :

phonegap build android

But it get stuck at this, nothing happen next :

[phonegap] detecting Android SDK environment...
[phonegap] using the remote environment
[phonegap] compressing the app...

After lot’s of research, I don’t know what I can do anymore to find the problem, and I’m quiet new with all this CLI… So yeah, do you have any idea why the command ‘android’ failed ?


How to&Answers:

Open environment variables, on the first part ‘user variables’ add new variable with this name android and the variable F:\android-sdk\sdk\tools;

Then edit the user variables PATH and add this at end of the line %android%;
close your CMD and try again.