问题描述
我下载了带有Visual Studio Emulator for Android"的Visual Studio 2015 Preview".
I downloaded "Visual Studio 2015 Preview" with "Visual Studio Emulator for Android".
模拟器与 Apache Cordova 应用程序配合良好(可以从文件 -> 新建 -> 项目 ->Apache Cordova 空白应用程序"创建).
Emulator is working good with Apache Cordova App (that can be created from File -> New -> Project -> "Apache Cordova Blank App").
但是当我尝试调试简单的 x86 android c++ 应用程序(可以创建 File -> New -> Project -> "Native Activity Application Android")时,Visual Studio Android Emulator 成功启动,之后 Visual Studio 给出错误:
But when I try to debug simple x86 android c++ app (that can be created File -> New -> Project -> "Native Activity Application Android"), Visual Studio Android Emulator is launched successfully, and after that Visual Studio give an error:
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++ 调试中正常运行
Update1:adb.exe 没有看到 VS Android 模拟器.为什么 - 这就是问题所在.
Update1: adb.exe doesn't see VS Android emulator. Why - that's the question.
更新2:adb devices"只有在命令adb connect 169.254.191.177:5555"后才开始看到VS模拟器.为什么默认情况下 adb 看不到 VS 模拟器 - 这就是问题所在.
Update2: "adb devices" began to see VS emulator only after command "adb connect 169.254.191.177:5555". Why by default adb don't see VS emulator - that's the question.
推荐答案
您是否在开头看到有关 ADB 的任何错误消息?考虑到它正在使用cordova,尝试重新启动一次以确保没有一次性问题.如果这不起作用,您可以使用
Do you see any error message in the beginning regarding ADB? Considering that it is working on cordova, try rebooting once to make sure there is no one-off problems. If that doesn't work, you can manually connect adb using
adb connect <ip>:5555
然后再次尝试该项目.
另外,请确保您的机器中安装了所有先决条件.当您创建一个新项目时,它会打开一个列出先决条件的网页.
Also, make sure you have all the pre-requisite installed in your machine. When you create a new project, it will open a web page listing the pre-requisites.
这篇关于Visual Studio 2015 Android 模拟器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!