我用“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 模拟器 - 这就是问题所在。