简体   繁体   English

如何将虚拟设备/模拟器附加到Visual Studio Xamarin Android项目?

[英]How can I attach a virtual device/emulator to Visual Studio Xamarin Android project?

I created an Android app for Ice Cream Sandwich and added nothing to the default code (except changing the text of the "Hello World" message - I couldn't - or wouldn't - help myself). 我为Ice Cream Sandwich创建了一个Android应用程序,并且没有添加任何默认代码(除了更改“Hello World”消息的文本 - 我不能 - 或者不会 - 帮助自己)。

I mashed F5. 我把F5捣碎了。

Nada - no device attached. Nada - 没有附加设备。 The dropdown list says "No Devices Attached." 下拉列表显示“没有附加设备”。

So, I set one up via the "Open Android Emulator Manager" button that the Xamarin install added: 所以,我通过Xamarin安装添加的“Open Android Emulator Manager”按钮设置了一个:

在此输入图像描述

I mashed F5 again; 我又把F5捣碎了; same problem. 同样的问题。 It said to pick a device from the dropdown list (I had forgotten to explicitly choose the one I just set up). 它说要从下拉列表中选择一个设备(我忘了明确选择我刚设置的那个)。 But...there's nothing in the list. 但是......列表中没有任何内容。 Why not? 为什么不?

UPDATE UPDATE

It's working now; 它现在正在运作; I reckon it was not showing me my device for selection because some Android packages were downloading in the background (via the "Android SDK Manager", also added by Xamarin). 我估计它没有向我显示我的设备供选择,因为一些Android软件包在后台下载(通过“Android SDK Manager”,也由Xamarin添加)。

I feel transported back two years, when I was "messing around with" Eclipse/Android/Java. 当我“熟悉”Eclipse / Android / Java时,我感觉回来了两年。

Awesome that you got it working. 真棒,你让它工作。

I found that list doesnt always update and a restart of Visual Studio was the quickest way to get the emulator in the list of devices to debug against. 我发现列表并不总是更新,重新启动Visual Studio是将模拟器放入要调试的设备列表中的最快方法。

If that doesnt work, try restarting the ADB service. 如果这不起作用,请尝试重新启动ADB服务。

  • Start the emulator. 启动模拟器。
  • Open up a command prompt, browse to the location of the Android SDK (default is '%LocalAppData%\\Android\\android-sdk\\platform-tools'). 打开命令提示符,浏览到Android SDK的位置(默认为'%LocalAppData%\\ Android \\ android-sdk \\ platform-tools')。
  • Run the command 'adb kill-server'. 运行命令'adb kill-server'。
  • Run 'adb devices' (this should show the running emulator as an attached device). 运行'adb devices'(这应该将正在运行的模拟器显示为连接的设备)。
  • Restart VS and you should see the emulator in the list. 重新启动VS,您应该在列表中看到模拟器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft Visual Studio 没有为 Xamarin 项目显示任何 android 模拟器或物理设备 - Microsoft visual studio doesn't show any android emulator or physical device for Xamarin project Xamarin 项目未显示在 Visual Studio Android 仿真器上 - Xamarin project is not showing up on Visual Studio Android Emulator 如何在 Android Studio 3.0 中摇动 Android 模拟器设备? - How can I shake an Android Emulator device in Android Studio 3.0? 如何在 Android Studio 中将我的物理设备作为模拟器运行? - How can I run my physical device as an emulator in Android studio? Android 模拟器不能与 Xamarin / Visual Studio Mac 一起使用 - Android Emulator not working with Xamarin / Visual Studio Mac Visual Studio:Xamarin - 启动 Android 模拟器时出错 - Visual Studio: Xamarin - Error starting Android Emulator 如何在 Ubuntu 中将虚拟相机发送到 Genymotion 或 Android Studio Emulator? - How can I send a virtual camera to Genymotion or Android Studio Emulator in Ubuntu? 如何在 Android Studio 模拟器中使用 Pixel 4(或任何支持 Face ID 的 Android 设备) - How can I use Pixel 4 (Or any Android device that supports Face ID) in Android Studio emulator 适用于Android的Visual Studio模拟器 - 项目不会部署 - Visual Studio Emulator for Android - Project does not Deploy 如何在android studio设备模拟器中模拟来自“不可用”的电话? - How can I simulate a phone call from “Unavailable” in the android studio device emulator?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM