I recently installed Visual Studio Tools for Apache Cordova CTP 3.1 in Visual Studio 2013 with Update 4 and when trying to build I kept getting the error:

Command failed with exit code 8 Visual Studio - mdavscli

The problem was that I has upgraded my version of Android SDK which was not compatible.

To troubleshoot this I turned on the diagnostic build here is how:

Go to Tools –> Options –> Projects and Solutions –> Build and Run, change MSBuild project build output verbosity to Diagnostic. Rebuild the project and post the text from output window

The output window showed the following error:

C:\Programs\SDK\tools\ant\build.xml:597: The following error occurred while executing this line:
C:\Programs\SDK\tools\ant\build.xml:649: The following error occurred while executing this line:
C:\Programs\SDK\tools\ant\build.xml:694: Execute failed: java.io.IOException: Cannot run program
(in directory “C:\code\samh\platforms\android\CordovaLib”): CreateProcess error=2,

after a little research I found out it looks like ant commands are broken in Android SDK 24.3, which cordova build is using.
I downgraded to previous release (24.2.0) and ant works fine now.

I downgraded to the following version of the sdk http://dl-ssl.google.com/android/repository/tools_r24.2-windows.zip 

To downgrade: