无法运行 Android 模拟器 [英] Unable to run Android Emulator
问题描述
我在 Visual Studio 2013 中有一个 Xamarin.Forms 项目,当我尝试运行我的 Android 应用程序时,模拟器会加载,但随后它不会加载应用程序,并且会发生不同的错误.
I have a Xamarin.Forms project in Visual Studio 2013 and when I try to run my Android application the emulator loads but then it doesn't load the app and different errors will occur.
当我尝试根据我选择的设置运行 Android 模拟器时,它会弹出
When I try to run the Android Emulator depending on what settings I chosen it either pops up with
DWP handshake failed
或在它显示的调试输出中
or in the debug output it shows
Couldn't connect to logcat, GetProcessId returned: 0
到目前为止,我发现的所有现有解决方案都没有奏效,即使它们过去曾奏效.
All existing solutions I have found haven't worked so far, even though they have worked in the past.
推荐答案
我只想在这里列出我为解决这个问题所做的所有事情,因为它发生在我身上几次,每次都有不同的原因.
I just wanted to list here all the things I have done to resolve this issue since it has happened to me a few times, with different reasons each time.
发布然后调试
有时您需要先在 Release 模式下将它运行到模拟器,然后您可以切换回 Debug 模式,然后它就可以工作了.
Sometimes you need to run it in Release mode first to the emulator, then you can switch back to Debug mode and it works.
快速部署
转到 Android 项目中的属性
Go to the properties in your Android Project
转到 Android 选项
Go to Android Options
关闭快速部署
如果不行,你也可以试试
If that doesn't work, you can also try
关闭共享运行时
Turning off Shared Runtime
将链接器设置为不链接
检查您的日志
打开 Android 设备日志,连接到您的模拟器并查看返回的消息.
Open up the Android Device Logging, connect to your emulator and see what messages are coming back.
对我来说,我看到了内存不足异常.模拟器只为其设置了 323 MB 的内存.打开模拟器管理器(设备日志旁边的图标),然后编辑您的模拟器.将内存增加到 512 MB(为我做到了),一切又开始工作了.
For me I saw an Out of Memory Exception. The emulator only had 323 MB of memory set for it. Open the emulator manager (the icon next to the device logging) and then edit your emulator. Increase the memory to 512 MB (that did it for me), and it all started working again.
如果这不能解决您的错误,更多场景将在 调试 Xamarin Android 构建和部署错误.
If this doesn't resolve your error, more scenarios are updated at Debugging Xamarin Android Build and Deployment Errors.
这篇关于无法运行 Android 模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!