简体   繁体   中英

Cannot initialize FFImageLoading, exception thrown

I am trying to use the FFImageLoading in a cross-platform xamarin app.

I followed the instructions, and installed the Xamarin.FFImageLoading and Xamarin.FFImageLoading.Forms in both the android and IOS projects.

I then use this code to intitialize the library:

[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 ());


    }
}

I haven't tried in it IOS yet. Not a priority.

I have the following XAML just to see if it works:

<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">

When I run it, I get:

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

Not sure what's going on. I suspect intellisense would have caught a missing using , and there are no errors during compile, only the one above, at runtime.

What have I done wrong!?

只需清理项目并重建。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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