Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

enter image description here

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.

like image 621
B. Clay Shannon-B. Crow Raven Avatar asked Mar 19 '14 23:03

B. Clay Shannon-B. Crow Raven


1 Answers

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.
like image 114
Adam Avatar answered Jan 04 '23 10:01

Adam