'Visual studio can't debug Android Xamarin app
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.
Solution 1:[1]
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.
Solution 2:[2]
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
Solution 3:[3]
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.
Solution 4:[4]
- Enter in "Solution properties"
- Select "Configurarion Properties"
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
Solution 5:[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.
Solution 6:[6]
Go to property of app project then click android option and checked checkbox in debugging section.then run again.
Solution 7:[7]
For anyone who might still need help. Also make sure the build and deploy checkbox's are checked in the configuration manager. .
Solution 8:[8]
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)
Got this from TedFalasco's answer on this post.
Solution 9:[9]
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.....
Solution 10:[10]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow