How do I debug on a real Android device using Xamarin for Visual Studio?

C#Visual StudioVisual Studio-2012XamarinXamarin Studio

C# Problem Overview


I've found a few links but they don't explain how this is done. I can debug using Xamarin Studio IDE but that IDE (no offense) is lame compared to Visual Studio 2012.
Using Visual Studio 2012, there appears to only be option to select an emulator to debug. So how do I get it to debug on my real device via USB (I already have USB Debugging = true)?

C# Solutions


Solution 1 - C#

I'm using Visual Studio 2017 with a OnePlus.

In order get debugging working I did the following.

  1. Go to Settings > About phone and tap Build Number repeatedly until developer mode is enabled
  2. Go into Settings > Developer options and turn USB debugging ON
  3. Connect you phone to your PC via USB. I had to plug my phone into my PC's onboard USB port, not my USB hub as this did not work
  4. You should be prompted to trust your PC (trust it)
  5. Fire up Visual Studio
  6. Open your solution and your device should now be available.

Side note: I have noticed that sometimes it also depends on the cable you use. If you still have no luck, perhaps try another cable.

Solution 2 - C#

You will get a confirmation prompt on the android device to ask if the PC is allowed to connect. It's easy to miss this if your device's screen has gone to sleep.

Solution 3 - C#

I'm using Visual Studio 2015 with Xamarin and the only way I can get it to recognize my Galaxy S4 is to turn USB debugging off and back on again while VS is running. This is required everytime I wish to use this phone with VS. I've never had to do this with Android Studio.

Solution 4 - C#

1 - Original drivers (Example: http://androidmtk.com/download-samsung-usb-drivers)

2 - Enable Developer's Options on mobile (for example on android 4.2.2, perform 7 click on "mobile info" - "serial number")

3 - USB debugging on your Mobile Developer's Options too

Solution 5 - C#

I also experienced a similar issue, I solved it by installing the USB drivers specific to my phone model.

Solution 6 - C#

tl;dr Install drivers if you haven't already done so.

As mentioned in one of the comments above I installed the device specific USB driver (LG drivers are here) and it solved my problem. It now works perfectly.

I was under the (incorrect!) impression I wouldn't need to install the drivers to enable debugging. I could already connect my device to my laptop to view files etc. and hence thought drivers were unnecessary.

Solution 7 - C#

Once everything else is ready, the device could appear under the "Not compatible devices" list. This could be happening if the "Minimun Android version" set in your project is higher than android version you have in your device. If so, you can set the "Minimun Android version" in the android manifest

Solution 8 - C#

I set my Mobile connection in USB charging mode and enable USB debugging. It may ask for driver installation, after driver installation disconnect the mobile and reconnect it, now this should show in Visual studio device list for debugging.

Solution 9 - C#

It looks like Xamarin Android Player is not installed. You will need to install this.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionjay_t55View Question on Stackoverflow
Solution 1 - C#Shane DixonView Answer on Stackoverflow
Solution 2 - C#Greg M.View Answer on Stackoverflow
Solution 3 - C#MarkView Answer on Stackoverflow
Solution 4 - C#Morcilla de ArrozView Answer on Stackoverflow
Solution 5 - C#Sibusiso MashitaView Answer on Stackoverflow
Solution 6 - C#kaybee99View Answer on Stackoverflow
Solution 7 - C#alvaroView Answer on Stackoverflow
Solution 8 - C#Prateek GuptaView Answer on Stackoverflow
Solution 9 - C#Rethina MaheshView Answer on Stackoverflow