简体   繁体   English

Xamarin表单Android应用程序崩溃使用VS Android模拟器运行调试

[英]Xamarin Forms Android App Crashes Running Debug with VS Android Emulator

I have a basic Xamarin Forms app I created. 我有一个基本的Xamarin Forms应用程序。 It works fine against the iOS simulator. 它适用于iOS模拟器。

However when I try and run with a VS Android Emulator (5.1in Marshmallow) it crashes every time upon opening. 但是,当我尝试使用VS Android模拟器(在Marshmallow中使用5.1)时,每次打开时都会崩溃。 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].

I am running VS2015 + Xamarin Forms 2.0 latest and greatest. 我正在运行VS2015 + Xamarin Forms 2.0最新和最好的。

What's going on here? 这里发生了什么?

In short: 简而言之:

1. "Could not connect to the debugger" issue (Android app starts and immediately closes, debugging stops): 1.“无法连接到调试器”问题(Android应用程序启动并立即关闭,调试停止):

  1. Close the Android simulator window to shut down the virtual machine. 关闭Android模拟器窗口以关闭虚拟机。
  2. Start the " Hyper-V Manager " (Microsoft program to manage virtual machines in Windows, you have it installed) 启动“ Hyper-V管理器 ”(用于管理Windows中的虚拟机的Microsoft程序,已安装)
  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 在Visual Studio中启动调试以重新启动模拟器

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

Go to the properties of the Android project, hit tab “Android options”, and unselect “Use Fast Deployment”. 转到Android项目的属性,点击“Android选项”标签,然后取消选中“使用快速部署”。

Source: Fix for “could not connect to the debugger” while deploying Xamarin Forms apps to the Visual Studio Android Emulator (VS2015) 来源: 修复了“无法连接到调试器”,同时将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. 这个问题似乎只发生在新一代处理器上,这就解释了为什么我以前从未见过它。

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. 这是因为Android的Visual Studio模拟器的Android映像与2015年的新一代英特尔处理器之间不兼容。

This solution is also published here: Visual studio android emulator will not start fully 这个解决方案也在这里发布: Visual Studio android模拟器不会完全启动

UPDATE November 29, 2017 更新2017年11月29日

You should really consider moving to the Android emulators provided by Google via Android Studio for Windows. 您应该考虑通过适用于Windows的Android Studio迁移到Google提供的Android模拟器。 Newer Android API levels (24 and above) are only available there and Microsoft does not seem to care . 较新的Android API级别(24及以上)仅在那里可用,而微软似乎并不关心

Unfortunately, we have no plans to publish Android images past 4.4. 很遗憾,我们没有计划在4.4之前发布Android图片。 We recommend that you try Google or GenyMotion's emulator for future images of the Android operating system. 我们建议您尝试使用Google或GenyMotion的模拟器来获取Android操作系统的未来图像。

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

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