Problems using Phonegap

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 with no problems. Then, as suggests , 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.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.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.5.1\bin\create.bat: Com mand failed with exit code 8] code: 8 }    [error] C:\Users\MEU_USUÁRIO\.cordova\lib\android\cordova.5.1\bin\create.bat: Co mmand failed with exit code 8

Searching the web, there are several different solutions, apparently each solution works for a different case. I tried npm install cordova , set JAVA_HOME , ANDROID_HOME , Path , installed Ant and set ANT_HOME e nothing said served me, I continue with the same error.

The solution presented this other question did not serve me. I do not know what else to do.

Remember that AndroidSDK + Eclipse was already installed and worked before I even installed Phonegap. I'm using Windows 7.

    
asked by anonymous 27.08.2014 / 20:54

2 answers

2

I was able to solve the problem in two steps:

  • Changing ANT_PATH to ANT_DIR as suggested by our friend @Caputo.

  • Installing version 19 of the SDK (before I was only 20).

Thanks to @Caputo for the force!

    
27.08.2014 / 22:20
0

To solve the second error, the correct one is not to simply install version 19, it works, yes, but if you want to use an older or newer version of the SDK just put the following lines in the config.xml file, in my case configured for Android 2.3 (SDK 10).

<preference name="android-minSdkVersion" value="10" />
<preference name="android-targetSdkVersion" value="10" />
    
17.04.2015 / 03:58