Question

I am trying to build a phonegap android,At that time i got a message that

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
   [error] An error occured during craetion of android sub-projesct. creating cordova project for the android platform 

Please help me. Thanks in advance.

Was it helpful?

Solution

Seems ant binary missing in your path! In you install ant with npm like:

sudo npm install -g ant

Then just make symlink to bin folder what found in your $PATH like

sudo ln -s /usr/local/lib/node_modules/ant/ant/bin/ant /usr/local/bin/ant

OTHER TIPS

There may be one of following two reasons-

1) .cordova directory already exists on your machine in your user folder. Delete it and try your command.

2)You have xcopy.exe somewhere on your machine. You should be able to add %SystemRoot%\System32 to your PATH. or You can find it by running 'where xcopy' in your terminal window. XCOPY on the path is a requirement for setting up and installing Android

You need to define XCOPY on your path as it is used by the internal node.js scripts to move things around.

One of these should solve your problem.

I had same problem with cordova 3.3.1 and phonegap 3.3.0. Finally, I opened Android SDK manager and found out Platform tools were outdated, though I had the latest version from here. After update, this error was gone

Run the "android" command from your adt\sdk\tools folder and install the latest Tools and SDK. Also make sure your PATH has the right variables.

For this you will need ANT to be installed , a JAVA JDK and an Android SDK installed

JAVA_HOME (C:\Program Files\Java\jdk)

ANT_HOME ({ant location}\apache\apache-ant)

ANDROID_HOME ({android sdk location}\android-sdk)

Add these to your PATH variable like %ANT_HOME%/bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin

Close and re-open your cmd and run your command again.

Similiar to PhoneGap/Cordova Android Development

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top