【问题标题】:Cannot initialize FFImageLoading, exception thrown无法初始化 FFImageLoading,抛出异常
【发布时间】:2017-11-15 01:54:44
【问题描述】:

我正在尝试在跨平台 xamarin 应用程序中使用 FFImageLoading。

我按照说明在 android 和 IOS 项目中安装了 Xamarin.FFImageLoading 和 Xamarin.FFImageLoading.Forms。

然后我使用这段代码来初始化库:

[Activity (Label = "app", Icon = "@drawable/icon", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
    protected override void OnCreate (Bundle bundle)
    {
        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar; 

        base.OnCreate (bundle);

        CachedImageRenderer.Init();

        global::Xamarin.Forms.Forms.Init (this, bundle);
        global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, bundle);

        LoadApplication (new TheWillowEffect.App ());


    }
}

我还没试过IOS。不是优先事项。

我有以下 XAML 只是为了看看它是否有效:

<ContentPage
....xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"....>

....

    <ffimageloading:CachedImage HorizontalOptions="Center" VerticalOptions="Center"
        WidthRequest="300" HeightRequest="300"
        DownsampleToViewSize="true"
        Source = "http://loremflickr.com/600/600/nature?filename=simple.jpg"
        Grid.Column="1"
        Grid.Row="1">

当我运行它时,我得到:

System.MissingMethodException: method 'FFImageLoading.Forms.Droid.CachedImageRenderer.init()' not found.

不知道发生了什么。我怀疑智能感知会发现丢失的using,并且在编译期间没有错误,只有在运行时出现上述错误。

我做错了什么!?

【问题讨论】:

  • 您是否尝试过清理解决方案?您是否在 xamarin.Android 中添加了正确的“使用”?
  • @AlessandroCaliaro wow.... 只需要打扫一下....谢谢!

标签: c# android xamarin.forms ffimageloading


【解决方案1】:

只需要清理项目并重建。

【讨论】:

    猜你喜欢
    • 2011-04-16
    • 2020-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多