Nirav Mehta
Nirav Mehta

Reputation: 1755

Command line failed with exit code 8 in phoneGap Cordova

I am trying to start with phonegap and cordova.

I follow step of http://phonegap.com/install/ , but at command $ phonegap run android in command prompt I get following error: Command line failed with exit code 8

My cordova in store is at C:\Users\MAC\.cordova\lib\android\cordova\3.4.0\bin\lib and WinAnt is at C:\Users\MAC\.cordova\lib\android\cordova\3.4.0\bin\lib\WinAnt.

Upvotes: 9

Views: 24767

Answers (8)

roj
roj

Reputation: 1373

I had 'command line failed with exit code 8' after I copied my workspace from another machine and tried the 'run' command on the new machine.
The 'phonegap run android' command will execute ant from the platforms\android directory. Execute it yourself and you may see a more detailed error message.

cd platforms/android  
ant  

Doing this helped me to identify the cause of my issue - the additional error information ant gave me highlighted that my Android Development Toolkit (ADT) installation was not at the location that ant was expecting. It must get written into the build command at the time the platform gets added.
I fixed this by (I'm using cordova) removing and re-adding android support as follows:

cordova platform remove android  
cordova platform add android  

You may be able to do the same. I'm guessing you can replace 'cordova' in the above commands with 'phonegap' and execute them to see if that fixes it. (I'm assuming you have already installed the Android Development Toolset (ADT) - if not, then that is probably the issue and you should install it!)

Upvotes: 19

user2463050
user2463050

Reputation: 1

just make sure your environment building good for other Android project,and check follows;

  1. is there some file name with special charset ? like chinese or ...
  2. is there a folder names crunch in project\bin\res\ ? it makes ant build failed

Upvotes: 0

Bitetti
Bitetti

Reputation: 81

I solve it changing in config.xml the line:

<preference name="android-minSdkVersion" value="7" />

to

<preference name="android-minSdkVersion" value="16" />

Upvotes: 0

Post Impatica
Post Impatica

Reputation: 16413

I had a similar issue trying to install a newer cordova plugin into Visual Studio 2013 with CTP3.1. In this case it was the latest camera plugin. After turning on diagnostic logging and rebuilding I found that it was trying to load the 'File' cordova plugin. I installed the File plugin and now everything works. It's funny that the official git page for the camera plugin says nothing about requiring the File plugin.

Upvotes: 0

DrSiemer
DrSiemer

Reputation: 330

I case anyone else is breaking his head over what could be causing the 'exit code 8' error: make sure you don't start your project name with a number! I tried all the other solutions before I figured that out...

Upvotes: 2

Brian Capouch
Brian Capouch

Reputation: 61

I'll add another one! In my case, it was because I (mistakenly) copied the config.xml from the HelloCordova project and then used it as the basis for my app.

The phone had previously run (and therefore installed) HelloCordova.

I got this error until I changed the name of the widget ID to something else, and then it ran just fine.

Upvotes: 1

Terence Chow
Terence Chow

Reputation: 11153

Adding my answer because I had this stupid error and it wasn't related to any of the above.

My issue was that I had set a library in eclipse for my app. However I then removed the library in eclipse by accident. This severed the tie for some reason and my app never ran.

I could tell it wasn't a path issue because when I ran cordova emulate android in a different application folder it would run fine. It was just with the app that I had accidentally removed the library in eclipse that was the issue. (Note that I didn't delete the library, just removed the part in eclipse where you rightclick the project and select android and select library. Deleting the library from the workspace caused this link to be removed and that was my issue)

Upvotes: 0

user1184211
user1184211

Reputation: 186

since this is the second link that comes up on google with a search for "command failed with exit code 8" and it provides no answer. I decided to answer it.

I was getting this error after I upgraded ecclipse and downloaded the modified one that google provides. This version moves the android/platform-tools and android/tools to a directory that is simply named SDK. You have to change your path variable and have it point to the correct location for the platform-tools and tools directories.

side note: https://www.java.com/en/download/help/path.xml - go there if you need help changing the path variable

Upvotes: 0

Related Questions