Using Microsoft debugger with Xamarin Android

There's an option in the Android project settings in the Android Options section on the Packaging tab that lets you choose between the Xamarin debugger or the Microsoft debugger. The Xamarin debugger works, but not as good as the Microsoft one might. Unfortunately I get an error message when trying to use the Microsoft debugger and deploy on one of the Visual Studio Android Emulators.

Unable to start debugging. Non-debuggable application installed on the target device. Required file '/data/data/My.Application/lib/gdbserver' could not be found on the device. Please install a debuggable version.

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


The Xamarin debugger can only debug managed (ie C#) code. Breakpoints only work with the Xamarin debugger if the project being debugged is a managed project. They don't work if the project is a native app or native library.

The Microsoft debugger can only debug native (ie C/C++) code. Breakpoints only work with the Microsoft debugger if the project being debugged is a native app or native library, or if it is attached to an already-running Android process.

To get gdbserver into the app package, you either have to reference a native code library from your managed app, or include it (with build action set to AndroidNativeLibrary). I found you can also add a link to gdbserver (again, with build action set to AndroidNativeLibrary) from a project and make use of path sniffing to select the gdbserver from the matching ABI. Snippet of project file:

  <ItemGroup>
    <AndroidNativeLibrary Include="$(ANDROID_NDK_ROOT)prebuiltandroid-armgdbservergdbserver">
      <Link>libarmeabi-v7agdbserver</Link>
    </AndroidNativeLibrary>
  </ItemGroup>

Also please see my answer to a similar question.

链接地址: http://www.djcxy.com/p/28408.html

上一篇: 指针中的constexpr是否有所作为?

下一篇: 与Xamarin Android一起使用微软调试器