FFImageLoading在Android中引发异常,错误为:System.TypeLoadException:由于找不到方法,因此无法加载方法替代列表:

Joh*_*inz 3 c# xaml xamarin

我刚刚开始将FFImageLoading用于Xamarin跨平台项目,并且Android MainActivity.cs文件引发未处理的异常:

System.TypeLoadException:由于找不到方法而无法加载方法替代列表:void
Xamarin.Forms.Platform.Android.IVisualElementRenderer.add_LayoutChange(System.EventHandler`1)

我已经看过很多东西了,不知道该怎么做。这是我正在使用的版本:

  • Xamarin.Forms v3.6.0.264807
  • Xamarin.FFImageLoading v2.4.4.859
  • Xamarin.FFImageLoading.Forms v2.4.4.859

我了解版本必须正确才能解决此问题。

我会投入更多,但我没有几个小时来弄清楚如何正确使用该网站。我不断收到有关我的代码如何无法识别4个空格的错误(显然是!!!!!!!!!)。我只是想成功地解决这个问题。

hal*_*ldo 6

更新资料

此问题已在版本2.4.6.929中解决。如果遇到此错误,请更新Xamarin Forms和FFImageLoading。


原始答案

您正在使用的FFImageLoading版本(v2.4.4.859)和Xamarin Forms 3.6版(以及3.4、3.5和3.6版)存在问题。

You can view the issue on their github Init exception with latest Xamarin.Forms 3.4 / 3.6. There is a fix in the pre-release version of FFImageLoading (v2.4.5.870-pre).

The only fixes that I know of at the moment are:

  1. Downgrade FFImageLoading to the previous version (2.4.3.840)
  2. Downgrade Xamarin Forms
  3. Use the pre-release version FFImageLoading (v2.4.5.870-pre, or v2.4.5.880-pre see update)

Be aware that the pre-release version of any software may be unstable and may still be in development. I would not recommend using pre-releases in a production environment.


Update

A user (PureWeen) has posted on the issues page:

https://www.nuget.org/packages/Xamarin.FFImageLoading/2.4.4.859

  • is incompatible with the latest versions of 3.4, 3.5, and 3.6, 4.0 pre(*)

https://www.nuget.org/packages/Xamarin.FFImageLoading/2.4.4.859 and all 2.4.5 versions prior to https://www.nuget.org/packages/Xamarin.FFImageLoading/2.4.5.880-pre are compatible with:


https://www.nuget.org/packages/Xamarin.FFImageLoading/2.4.5.880-pre

  • is compatible with the latest versions of 3.4, 3.5, and 3.6

https://www.nuget.org/packages/Xamarin.FFImageLoading/2.4.5.870-pre

  • is compatible with XF 3.6.0.264807

You can get the pre-release version from NuGet by selecting the Include prerelease checkbox in VisualStudio:

在此处输入图片说明