我在 Windows 10 build 10586 TH1 上使用 visual studio 2015 update 1。
我还使用 Xamarin 版本 4.0.1.96。
我创建了一个空白的 Xamarin.Forms 应用。 它可以毫无问题地部署到 Windows Phone 模拟器。但无法部署到 Android 模拟器。
当我启动 android 项目时,Android 模拟器成功启动 但 visual studio 在这一步卡住。
我试了很多android模拟器配置文件都无法解决问题。
此问题仅存在于模拟器和成功部署在物理 android 设备上的项目。
我对 Xamarin.Android 项目有同样的问题。
这是输出窗口中的所有文本:
- 1>开始部署 4.5"KitKat (4.4) HDPI 电话 ...
- 1>正在启动模拟器 4.5"KitKat (4.4) HDPI Phone ...
- 1>验证模拟器参数...
- 1>正在确定模拟器是否已经在运行...
- 1>准备虚拟机...
- 1>正在启动模拟器...
- 1>模拟器启动成功
预先感谢您的帮助。
最佳答案
我在模拟器启动查找时遇到了同样的问题,但 Visual Studio 在构建/部署时挂起。终于从here弄明白了.
Visual Studio gets stuck trying to deploy the app to the emulator or the emulator does not appear as a debug target in other IDEs
If the emulator is running, but it does not appear to be connected to ADB (Android Debug Bridge) or it does not appear in Android tools that make use of ADB (for example, Android Studio or Eclipse), you may need to adjust where the emulator looks for ADB. The emulator uses a registry key to identify the base location of your Android SDK, and looks for the \platform-tools\adb.exe file under that directory. To modify the Android SDK path used by the emulator:
- Open Registry Editor by selecting Run from the Start buttons context menu, typing regedit in the dialog box, and choosing OK.
- Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools in the folder tree on the left.
- Modify the Path registry variable to match the path to your Android SDK. Restart the emulator and you should now be able to see the emulator connected to ADB and associated Android tools.
我的注册表中的值设置为“C:\Program Files (x86)\Android\android_sdk”(或类似名称)。将其更新为“C:\Users\{USERNAME}\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK”为我解决了这个问题。 (我还没有担心如何让所有用户都能使用它。)
关于android - Xamarin.Android 项目无法在适用于 Android 的 Visual Studio 模拟器中部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35863809/