问题
I have installed Multi Device Hybrid apps and when I'm building and debugging new project it showing these three errors
Error 1 executing command 'ant', make sure you have ant installed and added to your path.
Error 2 C:\Users\User\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
Error 3 The command ""C:\Users\User\AppData\Roaming\npm\node_modules\vs-mda\vs-cli" prepare --platform iOS --configuration Debug --projectDir . --projectName "BlankCordovaApp2" --language "en-US"" exited with code 8.
But I have set all the paths and adt_home in environment variables and still it is showing this error what to do
回答1:
Try the following to check and enable all required Environment Variables
for Multi-Device Hybrid App.
Step 1:
Go to Visual Studio -> Debug Menu -> Multi-Device Hybrid Apps ->
Environment Variables Settings
Step 2:
Select Required Environment Variable from here as mentioned in
the attached screenshot

回答2:
Make sure ANT_HOME path is set to correct location like %systemdrive%\apache-ant-1.9.3
and make sure ANT is installed at location ANT_HOME is pointing. Also make sure system path is set to %ANT_HOME%\bin
. You can download ANT from here in case it is not already installed.
回答3:
I found the solution to “code 8” errors when building multi-device hybrid application project. The error message you get is: Error 2 \bld\Debug\platforms\android\cordova\build.bat: Command failed with exit code 8 \MDAVSCLI 1 1
This happens if you play around with the config.xml in DevStudio GUI (not textually edit the file). If you change the LaunchMode property and change it back to default value which is "singleTop", a new entry will be added to config.xml: <'preference name="AndroidLaunchMode" value="singletop" />
Just delete the entry, and your project compiles fine again. Quite a nasty bug in DevStudio
来源:https://stackoverflow.com/questions/25968686/missing-ant-and-code-8-errors-when-building-multi-device-hybrid-application-pr