如何使用 Xamarin for Visual Studio 在真实的 Android 设备上进行调试? [英] How do I debug on a real Android device using Xamarin for Visual Studio?

查看:25
本文介绍了如何使用 Xamarin for Visual Studio 在真实的 Android 设备上进行调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了一些链接,但它们没有解释这是如何完成的.我可以使用 Xamarin Studio IDE 进行调试,但与 Visual Studio 2012 相比,该 IDE(没有冒犯性)是蹩脚的.
使用 Visual Studio 2012,似乎只有选择要调试的模拟器的选项.那么如何让它通过 USB 在我的真实设备上进行调试(我已经有了 USB Debugging = true)?

I've found a few links but they don't explain how this is done. I can debug using Xamarin Studio IDE but that IDE (no offense) is lame compared to Visual Studio 2012.
Using Visual Studio 2012, there appears to only be option to select an emulator to debug. So how do I get it to debug on my real device via USB (I already have USB Debugging = true)?

推荐答案

我将 Visual Studio 2017 与 OnePlus 一起使用.

I'm using Visual Studio 2017 with a OnePlus.

为了让调试正常工作,我做了以下工作.

In order get debugging working I did the following.

  1. 转到设置>关于手机并反复点按版本号,直到启用开发者模式
  2. 进入设置>开发者选项并开启USB调试
  3. 通过 USB 将您的手机连接到您的 PC.我必须将手机插入 PC 的板载 USB 端口,而不是 USB 集线器,因为这不起作用
  4. 应该会提示您信任您的 PC(信任它)
  5. 启动 Visual Studio
  6. 打开您的解决方案,您的设备现在应该可以使用了.
  1. Go to Settings > About phone and tap Build Number repeatedly until developer mode is enabled
  2. Go into Settings > Developer options and turn USB debugging ON
  3. Connect you phone to your PC via USB. I had to plug my phone into my PC's onboard USB port, not my USB hub as this did not work
  4. You should be prompted to trust your PC (trust it)
  5. Fire up Visual Studio
  6. Open your solution and your device should now be available.

旁注:我注意到有时还取决于您使用的电缆.如果您仍然没有运气,也许可以尝试另一条电缆.

Side note: I have noticed that sometimes it also depends on the cable you use. If you still have no luck, perhaps try another cable.

这篇关于如何使用 Xamarin for Visual Studio 在真实的 Android 设备上进行调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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