3
I’m trying to use Phonegap for the first time, but I’m having problems.
I already had Nodejs installed, I was able to install Phonegap with npm install phonegap
without problems. Then, as you suggest this page, I created an app with phonegap create myapp
without problems, but when trying to run with phonegap run android
I got the following error:
C:\Users\MEU_USUÁRIO\Desktop\myapp>phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
C:\Users\MEU_USUÁRIO\.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.js:126
throw e;
^ Error: ERROR : executing command 'ant', make sure you have ant installed and add ed to your path.
at C:\Users\MEU_USUÁRIO\.cordova\lib\android\cordova\3.5.1\bin\lib\check_reqs.js: 47:27
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12) { [Error: C:\Users\MEU_USUÁRIO\.cordova\lib\android\cordova\3.5.1\bin\create.bat: Com mand failed with exit code 8] code: 8 } [error] C:\Users\MEU_USUÁRIO\.cordova\lib\android\cordova\3.5.1\bin\create.bat: Co mmand failed with exit code 8
Searching on the web, there are several different solutions, apparently each solution works for a different case. I tried npm install cordova
, configured JAVA_HOME
, ANDROID_HOME
, Path
, installed this guy from Ant and configured ANT_HOME
and nothing said served me, I continue with the same mistake.
The solution presented in this other question didn’t fit me. I don’t know what else to do.
Remember that Androidsdk + Eclipse was already installed and worked before I even installed Phonegap. I am using Windows 7.
This error is in relation to Ant_home which should actually be called ANT_DIR and also add it to the windows PATH. To be sure, run the command
ant
in cmd and see if it runs– Caputo
@Caputo Execute
ant
in cmd returnsBuildfile: build.xml does not exist!\nBuild failed
– user7261
And replaced ANT_HOME by ANT_DIR?
– Caputo
@Caputo Now I switched, the error has changed. Now he says that the "newer" version of the SDK, the 19, is not installed. I checked here and I have version 20. I’ll try to install the 19.
– user7261
If I don’t miss the memory, every version of the SDK that will be used needs to be installed separately, but you can set the SDK version in your phonegap APP’s JSON file or in the android manifest
– Caputo
@Caputo Brigadão! Now it’s working right =)
– user7261