4

我用“Visual Studio Emulator for Android”下载了“Visual Studio 2015 Preview”。

模拟器与 Apache Cordova 应用程序(可以从文件 -> 新建 -> 项目 ->“Apache Cordova 空白应用程序”创建)很好地配合使用。

但是当我尝试调试简单的 x86 android c++ 应用程序(可以创建文件 -> 新建 -> 项目 -> “Native Activity Application Android”)时,Visual Studio Android Emulator 成功启动,之后 Visual Studio 给出错误:

1>------ Deploy started: Project: Android.Packaging, Configuration: Debug x86 ------
1>Starting emulator...
1>Error installing the package. The device '169.254.191.177:5555' is invalid or not running.  Please switch to another device, or use the Android Virtual Device (AVD) Manager to start a compatible emulator, or connect a compatible Android device.
1>The device is invalid or is not running.
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

我检查过:

  • Android 模拟器的 IP 地址为 169.254.191.177 - 我可以在模拟器设置中看到它。
  • “ping 169.254.191.177” - 正在工作;
  • “telnet 169.254.191.177 5555” - 也在工作。

一些细节:

  • 在上部组合框中的 VS2015 中,我选择“VS Emulator Android Phone (x86 - offline)”
  • 我在 x86 架构中编译了 c++ 应用程序
  • 我有 Windows 8.1
  • 官方 AndroidSDK 模拟器与 Visual Studio 2015 c++ 调试一起正常工作

更新 1:adb.exe 没有看到 VS Android 模拟器。为什么——这就是问题所在。

更新 2:“adb 设备”仅在命令“adb connect 169.254.191.177:5555”之后才开始看到 VS 模拟器。为什么默认情况下 adb 看不到 VS 模拟器 - 这就是问题所在。

4

3 回答 3

9

您是否在开头看到任何关于 ADB 的错误消息?考虑到它正在科尔多瓦上运行,请尝试重新启动一次以确保没有一次性问题。如果这不起作用,您可以使用手动连接 adb

adb connect <ip>:5555

然后再次尝试该项目。

此外,请确保您的机器中安装了所有先决条件。当您创建一个新项目时,它将打开一个列出先决条件的网页。

于 2014-11-19T20:07:32.287 回答
7

确保 HKLM\Software\Wow6432Node\Android SDK Tools\Path 正确

于 2015-08-02T21:10:00.633 回答
4

您可以手动更新注册表:

  1. 在 regedit 中,导航到 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node。
  2. 创建一个名为 Android SDK Tools 的新密钥。
  3. 导航到该键。
  4. 创建一个名为 Path 的新字符串值。将其值设置为您的 Android SDK 的位置,例如 C:\Users\YourName\AppData\Local\Android\sdk。
  5. 然后重启模拟器。

现在,您将使用“adb devices”看到 VS 模拟器。

于 2015-11-15T09:51:14.463 回答