使用Microsoft调试器与Xamarin Android [英] Using Microsoft debugger with Xamarin Android

查看:157
本文介绍了使用Microsoft调试器与Xamarin Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

包装标签的 Android选项部分的Android项目设置中有一个选项,可以在Xamarin调试器或Microsoft调试器之间进行选择。 Xamarin调试器工作,但不如微软一样好。不幸的是,当尝试使用Microsoft调试器并在其中一个Visual Studio 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.


无法开始调试。不可调试应用程序安装在目标设备上。在设备上找不到所需的文件'/data/data/My.Application/lib/gdbserver'。请安装可调试版本。

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.

有没有办法让Microsoft调试器工作?

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

推荐答案

Xamarin调试器只能调试托管(即C#)代码。如果正在调试的项目是受管理的项目,则断点仅适用于Xamarin调试器。如果项目是本机应用程序或本机库,它们不起作用。

The Xamarin debugger can only debug managed (i.e. 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.

Microsoft调试器只能调试本机(即C / C ++)代码。如果被调试的项目是本地应用程序或本地库,或者如果它附加到已经运行的Android进程,则断点仅适用于Microsoft调试器。

The Microsoft debugger can only debug native (i.e. 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.

要获取gdbserver进入应用程序包,您必须从托管应用程序引用本机代码库,或将其包含(将构建操作设置为AndroidNativeLibrary)。我发现你也可以从一个项目中添加一个gdbserver的链接(再次,将build action设置为AndroidNativeLibrary),并利用路径嗅探从匹配的ABI中选择gdbserver。项目文件片段:

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)\prebuilt\android-arm\gdbserver\gdbserver">
      <Link>lib\armeabi-v7a\gdbserver</Link>
    </AndroidNativeLibrary>
  </ItemGroup>

另请参阅我的答案 类似的问题

这篇关于使用Microsoft调试器与Xamarin Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆