Xamarin Forms Android应用程序崩溃,使用VS Android仿真器运行调试 [英] Xamarin Forms Android App Crashes Running Debug with VS Android Emulator

查看:313
本文介绍了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仿真器(棉花糖中的5.1英寸)运行时,每次打开时它都会崩溃.即使当我尝试运行且未调试时.以下是我一直看到的错误:

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模拟器(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图像与新一代Intel处理器之间不兼容.

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通过适用于Windows的Android Studio提供的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天全站免登陆