android - 如何在 Visual Studio 2013 中的 Android 模拟器上运行应用程序

标签 android cordova visual-studio-2013

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

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

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

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 构建

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

谢谢,萨比

最佳答案

我遇到了同样的问题,折腾了好几天才解决。基本上 CTP 安装不会安装所有文件,因为 Windows Defender 会阻止它们(我不关心哪些文件。)

  1. 转到控制面板并卸载 CTP2、Java、Git、node、apple 的东西、android(基本上是原始 ctp 安装所做的一切)
  2. 重启电脑
  3. 关闭 Windows Defender 和任何其他防病毒软件
  4. 重新安装 CTP2
  5. 重启电脑
  6. 使用 Android AVD 创建一个新的模拟器
  7. 打开 Visual Studio 并创建一个新的空白 Cordova 应用
  8. 在 Android 模拟器中运行
  9. 重新打开 Windows Defender 和任何其他防病毒软件
  10. 对于现有项目,您可能必须在运行项目之前删除 bld 文件夹

希望对你有帮助

约翰乔利笨蛋

关于android - 如何在 Visual Studio 2013 中的 Android 模拟器上运行应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26478336/

相关文章:

android - 有没有一种简单的方法可以在phonegap中获得手机罗盘航向的准确性?

visual-studio-2013 - Visual Studio 2013 - JSLint.NET 已安装但未显示在工具中?

c++ - 使用命名空间系统;在 Visual Studio 2013 中

java - 在 Java 中将 String 转换为 CharSequence 或 char[] (Android 1.6 API)

Android 4.2.2 使操作栏图标和标题可点击,就好像是同一个按钮的一部分

angularjs - 有什么方法可以在 android studio 中构建混合应用程序(Ionic、AngularJs、Cordova)

android - 通过 Cordova 完成 android Activity

Android,如何创建上下文菜单...

java - Android:Java 是否对许多类效率较低

c# GridViewColumns 缺少程序集引用