简体   繁体   English

Visual Studio Xamarin:无法连接到调试器

[英]Visual Studio Xamarin: Could not connect to the debugger

I'm working with Visual Studio Community 2015 Update 3 and the Visual Studio Emulator for Android (API Level 19).我正在使用 Visual Studio Community 2015 Update 3 和 Visual Studio Emulator for Android(API 级别 19)。 Everything works fine, but since last Xamarin update I can't deploy to Visual Studio Emulator.一切正常,但自上次 Xamarin 更新以来,我无法部署到 Visual Studio 模拟器。

I click on run at visual studio and it deploys the app to the emulator (I cann see it in app drawer), then it starts the app.我单击 run at visual studio 并将应用程序部署到模拟器(我无法在应用程序抽屉中看到它),然后它启动应用程序。 But the app closes immediately, and visual studio says at output:但是应用程序立即关闭,visual studio 在 output 说:

Could not connect to the debugger.

Solutions I tried already (without success):我已经尝试过的解决方案(没有成功):

  • Enabled Migrate to a physical computer with a different processor version in Hyper-V settings在 Hyper-V 设置中启用迁移到具有不同处理器版本的物理计算机
  • Disabled Use Fast Deployment in project settings在项目设置中禁用使用快速部署

EDIT: On my real phone I can debug this app.编辑:在我的真手机上我可以调试这个应用程序。

EDIT2: Here's the logcat output EDIT2: 这是 logcat output

I've had this problem before. 我以前遇到过这个问题。 My problem was that the emulator was old and could not load things properly and was really slow. 我的问题是模拟器很旧,无法正确加载,而且速度很慢。 I suggest upgrading to a different emulator or just using your phone for debugging. 我建议升级到其他模拟器或只是使用手机进行调试。 If you want, you could try running it in release and see if it runs then. 如果需要,您可以尝试在发布中运行它,然后查看它是否运行。 If not create a new emulator from the AVD Manager. 如果没有从AVD Manager创建新的模拟器。

I had the same problem and it's really frustrating.我遇到了同样的问题,这真的很令人沮丧。 I had the problem for both Visual Studio 2019 and Visual Studio 2022.我在 Visual Studio 2019 和 Visual Studio 2022 上都遇到了问题。

I tried literally every solution on the web, and none of these worked for me:我几乎尝试了 web 上的所有解决方案,但没有一个对我有用:

  • updating everything in Visual Studio to the latest version将 Visual Studio 中的所有内容更新到最新版本
  • updating every Android SDK and component更新每个 Android SDK 和组件
  • sending various adb commands via the ADB console (like: adb -s 10.0.2.2:5554 root )通过 ADB 控制台发送各种adb命令(例如: adb -s 10.0.2.2:5554 root
  • @TienQuang solution in this post @TienQuang 在这篇文章中的解决方案
  • restarting multiple times Visual Studio and Windows多次重启 Visual Studio 和 Windows
  • deleting and recreating Android emulators images删除和重新创建 Android 模拟器图像

I was really out of solutions to try, and then... I simply reset my emulator proxy configuration (the always worked fine) switching to the "default Android Studio HTTP proxy settings", and now I can debug my application!我真的没有解决方案可以尝试,然后......我只是重置了我的模拟器代理配置(一直工作正常)切换到“默认 Android Studio HTTP 代理设置”,现在我可以调试我的应用程序了!

新的代理配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM