簡體   English   中英

無法初始化FFImageLoading,引發異常

[英]Cannot initialize FFImageLoading, exception thrown

我正在嘗試在跨平台的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 ,並且在編譯過程沒有錯誤,上面只有一個,在運行時。

我做錯了什么!

只需清理項目並重建。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM