Xamarin Forms Android 应用程序在使用 VS Android 模拟器运行调试时崩溃 [英] Xamarin Forms Android App Crashes Running Debug with VS Android Emulator

查看:43
本文介绍了Xamarin Forms Android 应用程序在使用 VS Android 模拟器运行调试时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个基本的 Xamarin Forms 应用程序.它在 iOS 模拟器上运行良好.

I have a basic Xamarin Forms app I created. It works fine against the iOS simulator.

但是,当我尝试使用 VS Android Emulator(5.1in Marshmallow)运行时,它每次打开时都会崩溃.即使我尝试在没有调试的情况下运行.以下是我一直看到的错误:

However when I try and run with a VS Android Emulator (5.1in Marshmallow) it crashes every time upon opening. Even when I try and run without debugging. Below is the error I keep seeing:

01-14 16:22:10.290 D/Mono    ( 1366): AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/App3.Droid-2/libaot-mscorlib.dll.so" not found
01-14 16:22:10.290 D/Mono    ( 1366): AOT module '/Users/builder/data/lanes/2512/d3008455/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/App3.Droid-2/libaot-mscorlib.dll.so" not found
01-14 16:22:10.294 D/Mono    ( 1366): Unloading image data-0x9659b010 [0xb93d5940].

我正在运行最新最好的 VS2015 + Xamarin Forms 2.0.

I am running VS2015 + Xamarin Forms 2.0 latest and greatest.

这是怎么回事?

推荐答案

简而言之:

1.无法连接到调试器"问题(Android 应用启动并立即关闭,调试停止):

  1. 关闭 Android 模拟器窗口以关闭虚拟机.
  2. 启动Hyper-V 管理器"(用于在 Windows 中管理虚拟机的 Microsoft 程序,您已安装)
  3. 选择您要使用的模拟器
  4. 右键单击上下文菜单,点击设置
  5. 在设置对话框中展开处理器
  6. 点击兼容性
  7. 在右侧窗格中设置复选框迁移到具有不同处理器版本的物理计算机"
  8. 在 Visual Studio 中启动调试以重启模拟器
  1. Close the Android simulator window to shut down the virtual machine.
  2. Start the "Hyper-V Manager" (Microsoft program to manage virtual machines in Windows, you have it installed)
  3. Select the emulator you are trying to use
  4. Right-click for context menu, hit Settings
  5. In the settings dialog expand Processor
  6. Click Compatibility
  7. In the right pane set checkbox "Migrate to a physical computer with a different processor version"
  8. Start the debugging in Visual Studio to restart the simulator

2.缺少 libaot-mscorlib.dll.so 问题:

转到 Android 项目的属性,点击Android 选项"选项卡,然后取消选择使用快速部署".

Go to the properties of the Android project, hit tab "Android options", and unselect "Use Fast Deployment".

来源:修复无法连接到调试器",同时将 Xamarin Forms 应用程序部署到 Visual Studio Android Emulator (VS2015)

这个问题似乎只出现在新一代处理器上,这就解释了为什么我以前从未见过它.

This issue only seems to be occurring on the newer generation of processors, which explains why I never saw it before.

发生这种情况的原因是,截至 2015 年,适用于 Android 的 Visual Studio 模拟器的 Android 映像与新一代英特尔处理器之间不兼容.

This happens because of an incompatibility between the Android images for the Visual Studio emulator for Android and the newer generations of Intel processors as of year 2015.

此解决方案也在此处发布:Visual Studio android 模拟器将无法完全启动

This solution is also published here: Visual studio android emulator will not start fully

2017 年 11 月 29 日更新

您真的应该考虑迁移到 Google 通过 Android Studio for Windows 提供的 Android 模拟器.较新的 Android API 级别(24 及以上)仅在那里可用,并且 微软似乎并不关心.

You should really consider moving to the Android emulators provided by Google via Android Studio for Windows. Newer Android API levels (24 and above) are only available there and Microsoft does not seem to care.

很遗憾,我们不打算发布 4.4 以后的 Android 图像.我们建议您尝试使用 Google 或 GenyMotion 的模拟器来获取 Android 操作系统的未来映像.

Unfortunately, we have no plans to publish Android images past 4.4. We recommend that you try Google or GenyMotion’s emulator for future images of the Android operating system.

这篇关于Xamarin Forms Android 应用程序在使用 VS Android 模拟器运行调试时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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