Thomas
Thomas

Reputation: 79

PhoneGap Android Error "create.bat exit code 8"

Iam followed a guide to create my first project on PhoneGap and I wanted to run it on a Android Emulator. So I typed

phonegap run android

Some stuff loaded but than I got the following error:

C:\Users\Thomas\form>phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...

C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\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\Thomas\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:4
7:27
    at ChildProcess.exithandler (child_process.js:652:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Socket.<anonymous> (child_process.js:969:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)
{ [Error: C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Comm
and failed with exit code 8] code: 8 }
   [error] C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Com
mand failed with exit code 8

EDIT:

After following the instructions I installed ant and didnt get the error anymore. But there are still some other errors:

C:\Users\Thomas\form>phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...

C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:87:29
    at _rejected (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:808:24)
    at C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:834:30
    at Promise.when (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:1079:31)
    at Promise.promise.promiseDispatch (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:752:41)
    at C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:574:44
    at flush (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:108:17)
    at process._tickCallback (node.js:419:13){ [Error: C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8] code: 8 }
   [error] C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8

EDIT2: Ok I solved the problem. I needed to install JAVA JDK, Android SDK and assign some environmental variables...

Best regards

Upvotes: 0

Views: 4119

Answers (2)

Marc Stevenson
Marc Stevenson

Reputation: 1100

This does seem to a generic error without much description on its own. For me I am consistently seeing this build error if I set the app configuration to portrait only using a VS 2015 RC Cordova project.

Upvotes: 0

AtanuCSE
AtanuCSE

Reputation: 8940

You need to download the ant manually from http://ant.apache.org/bindownload.cgi

Then extract it somewhere. Suppose in drive D:\apache-ant-1.9.3

Next add the environment variable ANT_HOME with it's value D:\apache-ant-1.9.3

Lastly add this to path variable %ANT_HOME%\bin

Don't forget to restart terminal or command prompt

Upvotes: 2

Related Questions