简体   繁体   English

构建xamarin.forms Android解决方案会导致Monoandroid10的BadImageFormatException

[英]Building xamarin.forms Android solution results in BadImageFormatException of Monoandroid10

Been developing an application which, as for now, runs only on iOS and everything runs great here. 正在开发一个应用程序,目前只在iOS上运行,一切都运行得很好。 Now I want to run the Android Project, but I keep getting this error: 现在我想运行Android项目,但我一直收到这个错误:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA0009: Error while loading assembly: /Users/ulriksandberg/.nuget/packages/system.runtime.loader/4.3.0/lib/MonoAndroid10/ . /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2):错误:加载程序集时出现异常:Java.Interop.Tools.Diagnostics.XamarinAndroidException:错误XA0009:加载程序集时出错:/Users/ulriksandberg/.nuget/packages/system.runtime.loader/4.3.0/lib/MonoAndroid10/ ---> System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid. ---> System.BadImageFormatException:可执行文件(.exe)或库(.dll)的格式无效。

I'm running on the local emulator Android_Accelerated_Oreo, or atleast I want to. 我正在本地模拟器Android_Accelerated_Oreo上运行,或至少我想要。

XA0009 Error while loading assemblies: {0}. XA0009加载程序集时出错:{0}。

Much of the reason for this error is due to the fact that the program is loading NuGet packages or other bound library files.You can try the following method: 此错误的大部分原因是由于程序正在加载NuGet包或其他绑定的库文件。您可以尝试以下方法:

  1. Check if there are any unused Nuget packages in the project, but keep a reference to them, then you need to remove all references related to them. 检查项目中是否有任何未使用的Nuget包,但保留对它们的引用,然后您需要删除与它们相关的所有引用。
  2. Check if there are incorrectly installed Nuget packages, please reinstall them 检查Nuget包是否安装不正确,请重新安装
  3. If there is a library file reference, the same processing as the Nuget package 如果有库文件引用,则与Nuget包的处理相同

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

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