Visual studio can't debug Android Xamarin app
Asked Answered
W

12

20

I've started with Xamarin and Android using Visual Studio 2013.

When I start debugging the android app, it builds, deploys to device and then debugging in Visual Studio stops. I can't hit any breakpoint. App is working in device, but I cannot debug it. Am I missing something? I've tried various emulators and a physical android device but debugging doesn't work in any of them. It just act like I have stopped it.

Debugging the same solution in Xamarin Studio works, I just can't get it working in Visual Studio.

Waterish answered 16/9, 2015 at 20:3 Comment(0)
C
8

Make sure you are running on Debug mode (on target).

Then, check the Properties of the App Project and see if it's using the Xamarin debugger instead of the VisualStudio Debugger.

Craunch answered 16/9, 2015 at 20:8 Comment(8)
Hi Marcos, configuration is set to Debug mode, and Debugger to Microsoft. I have tried possibly every combination in settings but still the same. After deploy it is over with VS and app is living its own life in the device,Waterish
You must choose "Xamarin" debugger, not the Microsoft one.Craunch
Well, that's the only configuration I know, can't you create a new project from the Xamarin templates and debug it?Craunch
Today I just put debugger back to Xamarin and it finally works... But I don't really know which other settings had I changed... Anyway thanks for help and I'll mark your answer, as it was part of solutionWaterish
Where is that Debugger option?? I don't see it any where in the project propertiesMemo
Proejct --> properties --> Android otpions --> (at the bottom there is a dropdown) It is strange, but for me the Microsoft debugger worked.Disfeature
@JanSkála i have done the same but still it's not working for me :(Hermy
This does not work for me. The project is "Debug/Any CPU". Debugger is ".Net(Xamarin)" (the only other option is C++)Thebault
D
12

Another reason why Visual studio can't debug Android Xamarin app with a Hyper-V is due to you don´t have 'Deploy" option check in android project.

Steps: 1) Enter in "Solution properties" 2) Select "Configurarion Properties" 3) Check "Deploy" in Android project.

Dustproof answered 4/8, 2016 at 9:7 Comment(0)
E
11

I was having the same problem and I found this workaround with Hyper-V in Xamarin's documentation: https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/debug-on-emulator/visual-studio-android-emulator/

TL;DR; Open Hyper-V Manager -> Go to settings on your emulator -> Go to processor settings -> Select Compatibility -> Mark the "Migrate to a physical computer with a different processor version" checkbox -> Done! (At least for me) VS is now debugging my Android App

Extricate answered 9/5, 2016 at 15:24 Comment(3)
Thank you for saving my time. I follow 2 steps 1) Checked to see .Droid project if it's debugger is Xamarin. 2) Set Processor Compatibility by turning on "Migrate to a physical computer with a different processor version" 3) Shut down VS 4) Turn off running emulator 5) Re-run it using VS Emulator Manager 5) Re-open VS 6) Start debug with VS.Rolfston
Thank you very muchThebault
FYI for people who can't find Hyper-V and want to enable it: enabling Hyper-V Manager disabled my hardware acceleration and now my emulator runs super slow.Dianndianna
C
8

Make sure you are running on Debug mode (on target).

Then, check the Properties of the App Project and see if it's using the Xamarin debugger instead of the VisualStudio Debugger.

Craunch answered 16/9, 2015 at 20:8 Comment(8)
Hi Marcos, configuration is set to Debug mode, and Debugger to Microsoft. I have tried possibly every combination in settings but still the same. After deploy it is over with VS and app is living its own life in the device,Waterish
You must choose "Xamarin" debugger, not the Microsoft one.Craunch
Well, that's the only configuration I know, can't you create a new project from the Xamarin templates and debug it?Craunch
Today I just put debugger back to Xamarin and it finally works... But I don't really know which other settings had I changed... Anyway thanks for help and I'll mark your answer, as it was part of solutionWaterish
Where is that Debugger option?? I don't see it any where in the project propertiesMemo
Proejct --> properties --> Android otpions --> (at the bottom there is a dropdown) It is strange, but for me the Microsoft debugger worked.Disfeature
@JanSkála i have done the same but still it's not working for me :(Hermy
This does not work for me. The project is "Debug/Any CPU". Debugger is ".Net(Xamarin)" (the only other option is C++)Thebault
E
7
  1. Enter in "Solution properties"
  2. Select "Configurarion Properties"
  3. Check "Deploy" in Android project.

    • Open Hyper-V Manager
    • Go to settings on your emulator
    • Go to processor settings
    • Select Compatibility
    • Mark the "Migrate to a physical computer with a different processor version" checkbox
Exultant answered 23/9, 2016 at 11:32 Comment(0)
S
5

This will also happen if you don't have any activity marked as your main launcher activity:

[Activity(
    ...
    MainLauncher = true,
    ...)]
public class MainActivity ...

Easy mistake to make if you're shifting code in from a prior project and the prior project is using a splash activity and your new project is not yet doing so.

Sudhir answered 24/10, 2016 at 3:21 Comment(1)
Thank you! This was my case :)Searle
Z
4

For anyone who might still need help. Also make sure the build and deploy checkbox's are checked in the configuration manager. . enter image description here

Zita answered 16/5, 2018 at 12:53 Comment(0)
D
3

Go to property of app project then click android option and checked checkbox in debugging section.then run again.

enter image description here

Desertion answered 25/5, 2017 at 10:50 Comment(1)
Also Clear solution (Build-> Clean solution) before runningDesertion
O
1

In my case, after some investigation, I saw I was having this warning: "Failed to read .android.dll' with debugging symbols. Retrying to load it without it. Error details are logged below. 2>Mono.Cecil.Cil.SymbolsNotMatchingException: symbols were found but are not mathing the assembly"

The solution was to disable linking:

Right-click the Android Project -> Properties -> Android Options -> Under "Linker properties", set Linking to None (see image below)

enter image description here

Got this from TedFalasco's answer on this post.

Omphale answered 7/10, 2020 at 12:57 Comment(0)
H
0

Hyper-V manager can't be installed on Windows 7 (only the management tool gets installed) so if you get this problem, following those steps don't help.

Here is the thing that worked for me and it's mentioned here as an answer but hasn't been marked up or marked as an answer. This is actually the best and easiest solution. nothing else worked for me.

In Visual studio, make sure you choose the solution file (not project files) in the solution explorer. Then go "Project > [project]properties" in the left pane choose "Configuration Properties > Configuration" Now check the Deploy feature if possible. Only deployable projects have the option.

This saved my life and I almost gave up on Xamarin. I really hope this helps others like me.....

Homesick answered 31/8, 2016 at 12:34 Comment(2)
Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. - From ReviewRheinland
I see it's the answer just above this one by Raul Martin Ramos that as it stands won't be taken seriously enough. Just my thought. Also the fact that Hyper-V manager isn't available for Windows 7 is important here and should be mentioned in this forum thread.....Homesick
A
0

In my case, the warning was self-explanatory:

Set the debugging information to Portable in the Visual Studio project property pages or edit the project file in a text editor and set the 'DebugType' MSBuild property to 'portable' to use the newer

In other words: Right click on project => properties => build => click on advanced => set the debugging information to portable.

Airwaves answered 24/4, 2022 at 2:18 Comment(0)
M
0

I have tried every answer and none of them worked.

Here is what I did to make it work again:

  1. Plug your physical android device to the computer. Android device must have Developer options enabled.
  2. Choose your android device in Visual Studio.
  3. Run app in Debug mode. Your app should appear on your android device.
  4. Unplug your android device from computer.
  5. Try running your app in android emulator. For me Debug option starts working again.
Ml answered 23/11, 2022 at 5:42 Comment(0)
Q
0

I had some of the problems described here till...

I just DELETED the content of Debug and Release folders, no more problems.

It may help you.

TNX

Quirites answered 19/5, 2024 at 9:37 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Pythagoreanism

© 2022 - 2025 — McMap. All rights reserved.