【问题标题】:Xamarin Forms Deploy error Could not load assembly 'System.Memory'Xamarin Forms Deploy 错误无法加载程序集“System.Memory”
【发布时间】:2018-06-29 08:36:27
【问题描述】:

Xamarin Forms Android

一些最近的 nuget 包级别导致了这个错误。 我们只使用稳定包,但我开始尝试更新的 Xamarin 预发布包,看看问题是否已解决。

构建和调试输出中出现错误的部分。

Assembly Loader 探测位置:“System.Memory”。 07-06 10:10:51.972 F/monodroid-assembly(4029): 在启动注册期间无法加载程序集“System.Memory”。

编译设置为使用最新(8.1) 最低版本为 7.0

从其他帖子中,我尝试删除共享运行时,并尝试使用和检查使用的共享运行时的 Android 选项。

编辑 3:Debug 的更新输出:

07-06 10:10:48.375 D/Mono (4029): AOT: image '/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖 /Xamarin.Forms.Platform.dll.so' 未找到:dlopen 失败:库“/data/app/com.Oxando.OxandoXPC-xDHzK4ivf73vZ_mvi0X4Jg==/lib/x86/libaot-Xamarin.Forms.Platform.dll.so”未找到 07-06 10:10:48.376 D/Mono (4029): AOT: image '/usr/local/lib/mono/aot-cache/x86/Xamarin.Forms.Platform.dll.so' not found: dlopen failed:未找到库“/data/app/com.Oxando.OxandoXPC-xDHzK4ivf73vZ_mvi0X4Jg==/lib/x86/libaot-Xamarin.Forms.Platform.dll.so” 07-06 10:10:48.376 D/Mono(4029):Assembly Loader 从以下位置加载程序集:'/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/Xamarin.Forms.Platform.dll'。 07-06 10:10:48.376 D/Mono(4029):配置尝试解析:'/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/ Xamarin.Forms.Platform.dll.config'。 07-06 10:10:48.376 D/Mono(4029):配置试图解析:'/usr/local/etc/mono/assemblies/Xamarin.Forms.Platform/Xamarin.Forms.Platform.config'。 07-06 10:10:48.376 D/Mono(4029):Assembly Loader 探测位置:'/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/ Xamarin.Forms.Xaml.dll'。 07-06 10:10:48.376 D/Mono (4029): Image addref Xamarin.Forms.Xaml[0xcbf3d2c0] -> /storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/Xamarin.Forms.Xaml.dll[0xcbf50400]:2 07-06 10:10:48.376 D/Mono(4029):准备设置程序集“Xamarin.Forms.Xaml”(/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/Xamarin.Forms.Xaml.dll) 07-06 10:10:48.376 D/Mono(4029):程序集 Xamarin.Forms.Xaml[0xcbf3d2c0] 添加到域 RootDomain,ref_count=1 07-06 10:10:48.377 D/Mono (4029): AOT: image '/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/Xamarin。未找到 Forms.Xaml.dll.so':dlopen 失败:未找到库“/data/app/com.Oxando.OxandoXPC-xDHzK4ivf73vZ_mvi0X4Jg==/lib/x86/libaot-Xamarin.Forms.Xaml.dll.so” 07-06 10:10:48.378 D/Mono (4029): AOT: image '/usr/local/lib/mono/aot-cache/x86/Xamarin.Forms.Xaml.dll.so' not found: dlopen failed:未找到库“/data/app/com.Oxando.OxandoXPC-xDHzK4ivf73vZ_mvi0X4Jg==/lib/x86/libaot-Xamarin.Forms.Xaml.dll.so” 07-06 10:10:48.378 D/Mono(4029):Assembly Loader 从以下位置加载程序集:'/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/Xamarin.Forms.Xaml.dll'。 07-06 10:10:48.378 D/Mono(4029):配置尝试解析:'/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/ Xamarin.Forms.Xaml.dll.config'。 07-06 10:10:48.378 D/Mono(4029):配置试图解析:'/usr/local/etc/mono/assemblies/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.config'。 07-06 10:10:48.378 D/Mono(4029):Assembly Loader 探测位置:'/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/ System.Memory.dll'。 07-06 10:10:48.378 D/Mono (4029): Image addref System.Memory[0xcbf3d4a0] -> /storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/System.Memory.dll[0xcbf50e00]: 2 07-06 10:10:48.378 D/Mono (4029): 程序集“System.Memory”的图像 (/storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.覆盖/System.Memory.dll) 有 ReferenceAssemblyAttribute,跳过 07-06 10:10:48.378 D/Mono (4029): 卸载图像 /storage/emulated/0/Android/data/com.Oxando.OxandoXPC/files/.override/System.Memory。 dll [0xcbf50e00]。 07-06 10:10:48.379 D/Mono(4029):Assembly Loader 探测位置:'/usr/local/lib/System.Memory.dll'。加载的程序集:/storage/emulated/0/Android/data/com .Oxando.OxandoXPC/files/.覆盖/SQLitePCLRaw.batteries_green.dll [外部] ...
...
装配加载程序探测位置:“System.Memory”。 07-06 10:10:51.972 F/monodroid-assembly(4029):在启动注册期间无法加载程序集“System.Memory”。 07-06 10:10:51.972 F/monodroid-assembly(4029):这可能是由于调试安装无效。 07-06 10:10:51.972 F/monodroid-assembly(4029):一个常见的原因是直接“adb install”应用程序,而不是从 IDE 执行。

【问题讨论】:

  • 您是否尝试过:删除 bin/obj 文件夹。从模拟器/手机卸载应用程序,重新启动visual studio,在android选项->取消“使用共享运行时”?
  • 您好 Bruno,您的想法可能已经解决了一个问题。它现在在别处轰炸:(
  • 我尝试了一些想法。 System.Memory 的系统部署问题

标签: xamarin.forms


【解决方案1】:
Can you try this Go to android Project>Right the Properties>Go to Android options>Advanced>In supported architecture tick all and set Java max Heap Size to 1 G if that not working can you try this 


This seemed to work for me. I will have to do more testing when I get time. Found it on the EF Core git bug lists.

Manually edit your csproj file and define, that the NU1605 warning shouldn't be treated as an error.

<PropertyGroup>
  <NoWarn>$(NoWarn);NU1605</NoWarn>
</PropertyGroup>
Now in your Project File add the Package:

<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.3.0" />
Then I would:

Clean the NuGet Caches
Clean all bin and obj folders
Restore the Packages
Build

【讨论】:

  • x86 在支持的架构列表中,我将 1G 设置为最大堆大小。 im 结果又是原来的错误。
  • 我仍在测试您的建议。包括手动不安全的包 IM 发生冲突和错误 Assembly Loader probing location: 'System.Runtime.CompilerServices.Unsafe'。可能版本不对
  • 你可以从 nuget 包中添加最新的
  • 使用最新的 nuget 版本的 ComplierServices.Unsafe (4.5.1) 它现在返回到无法在启动注册期间加载程序集“System.Memory”。
  • 感谢您试用 Adit,但看起来这确实加载了 system.Memory。
猜你喜欢
  • 2016-06-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-17
  • 2018-01-18
  • 2016-03-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多