Using Microsoft Debugger with Xamarin Android

In the Android project settings, in the Android Settings section, select the Packaging tab, which allows you to choose between the Xamarin debugger or the Microsoft debugger. The Xamarin debugger works, but not as good as Microsoft. Unfortunately, I get an error when I try to use the Microsoft debugger and deploy to one of the Visual Studio for Android emulators.

Unable to start debugging. Inappropriate application installed on the target device. Required file '/data/data/My.Application/lib/gdbserver' not found on device. Please install the debug version.

Is there a way to get the Microsoft debugger to work?

+7
android debugging visual-studio-2015 xamarin xamarin.android
source share
1 answer

The Xamarin debugger can only debug managed (i.e. C #) code. Breakpoints only work with the Xamarin debugger if the debugged project is a managed project. They do not work if the project is a native or native library.

The Microsoft debugger can only debug its own (for example, C / C ++) code. Breakpoints work only with the Microsoft debugger if the debugged project is a native application or its own library or if it is connected to an already running Android process.

To get gdbserver into the application package, you either need to reference your own code library from the managed application, or enable it (with the assembly action installed in AndroidNativeLibrary). I found that you can also add a link to gdbserver (again, with the build action installed in AndroidNativeLibrary) from the project, and use path sniffing to select gdbserver from the corresponding ABI. Project file fragment:

<ItemGroup> <AndroidNativeLibrary Include="$(ANDROID_NDK_ROOT)\prebuilt\android-arm\gdbserver\gdbserver"> <Link>lib\armeabi-v7a\gdbserver</Link> </AndroidNativeLibrary> </ItemGroup> 

Also see my answer to a similar question .

+3
source share

All Articles