如何在Visual Studio 2013的Android Emulator上运行应用程序

如何在Visual Studio 2013的Android Emulator上运行应用程序,android,cordova,visual-studio-2013,Android,Cordova,Visual Studio 2013,我想用Visual Studio 2013开发多设备混合应用程序。 我的问题(我从几个小时后就对它感到绝望): 当我创建一个BlankCordovaApp项目时,我可以使用Visual Studio的Ripple Emulator运行这个应用程序。这很有效 但是,当我尝试使用Android Emulator运行它时,会出现以下错误: BUILD FAILED 1> C:\Users\Sabi\AppData\Local\Android\android-sdk\tools\ant\buil

我想用Visual Studio 2013开发多设备混合应用程序。 我的问题(我从几个小时后就对它感到绝望):

当我创建一个BlankCordovaApp项目时,我可以使用Visual Studio的Ripple Emulator运行这个应用程序。这很有效

但是,当我尝试使用Android Emulator运行它时,会出现以下错误:

BUILD FAILED
1>  C:\Users\Sabi\AppData\Local\Android\android-sdk\tools\ant\build.xml:932: The following error occurred while executing this line:
1>  C:\Users\Sabi\AppData\Local\Android\android-sdk\tools\ant\build.xml:950: null returned: -1073741819
1>  
1>  Total time: 5 seconds
1>  Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Users\Sabi\Desktop\Development\Learning\Learning\bld\Debug\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
1>  Command finished with error code 2: C:\Users\Sabi\Desktop\Development\Learning\Learning\bld\Debug\platforms\android\cordova\build.bat --debug,
1>  
1>  C:\Users\Sabi\AppData\Roaming\npm\node_modules\vs-mda\node_modules\q\q.js:126
1>                      throw e;
1>                            ^
1>EXEC : error : C:\Users\Sabi\Desktop\Development\Learning\Learning\bld\Debug\platforms\android\cordova\build.bat: Command failed with exit code 2
1>      at ChildProcess.whenDone (C:\Users\Sabi\AppData\Roaming\npm\node_modules\vs-mda\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
1>      at ChildProcess.EventEmitter.emit (events.js:98:17)
1>      at maybeClose (child_process.js:753:16)
1>      at Process.ChildProcess._handle.onexit (child_process.js:820:5)
1>C:\Users\Sabi\AppData\Roaming\npm\node_modules\vs-mda-targets\Microsoft.MDA.targets(99,5): error MSB3073: Der Befehl ""C:\Users\Sabi\AppData\Roaming\npm\node_modules\vs-mda\vs-cli" build --platform "Android" --configuration "Debug" --projectDir . --projectName "Learning" --language "de-DE" --buildServerUrl "" --buildTarget "AndroidEmulator"" wurde mit dem Code 8 beendet. (exit with code 8)
我找到了很多关于检查环境路径变量之类的答案。 我还检查了工具-选项-多设备混合应用程序-环境变量覆盖中的环境变量。但他们是对的

当我尝试在没有Visual Studio的情况下构建cordova应用程序时,它可以工作,并且该应用程序可以在我的Android仿真器上运行

但这仅在我创建新项目时有效:

$cordova create hello com.example.hello“hello World”
$cd你好
$cordova平台添加android
$cordova build

如果我想用“$cordova build”构建Visual Studio项目,我会收到与Visual Studio中相同的错误


谢谢,萨比,我也有同样的问题,在我解决之前,我挣扎了好几天。基本上,CTP安装不会安装所有文件,因为Windows Defender会阻止它们(我不在乎是哪些文件)

  • 转到控制面板&卸载CTP2、Java、Git、node、apple、android(基本上是原始ctp安装所做的一切)
  • 重新启动电脑
  • 关闭Windows Defender和任何其他防病毒软件
  • 重新安装CTP2
  • 重新启动电脑
  • 使用Android AVD创建新的仿真器
  • 打开Visual Studio并创建一个新的空白Cordova应用程序
  • 在Android仿真器中运行
  • 重新启用Windows Defender和任何其他防病毒软件
  • 对于现有项目,您可能必须在运行项目之前删除bld文件夹
  • 希望这有帮助

    约翰霍利斯托皮德