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

喜欢而已 提交于 2019-12-22 06:59:15

问题


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).

I mashed F5.

Nada - no device attached. The dropdown list says "No Devices Attached."

So, I set one up via the "Open Android Emulator Manager" button that the Xamarin install added:

I mashed F5 again; 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

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).

I feel transported back two years, when I was "messing around with" Eclipse/Android/Java.


回答1:


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.

If that doesnt work, try restarting the ADB service.

  • Start the emulator.
  • Open up a command prompt, browse to the location of the Android SDK (default is '%LocalAppData%\Android\android-sdk\platform-tools').
  • Run the command 'adb kill-server'.
  • Run 'adb devices' (this should show the running emulator as an attached device).
  • Restart VS and you should see the emulator in the list.


来源:https://stackoverflow.com/questions/22520602/how-can-i-attach-a-virtual-device-emulator-to-visual-studio-xamarin-android-proj

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!