[英]Cannot initialize FFImageLoading, exception thrown
I am trying to use the FFImageLoading in a cross-platform xamarin app. 我正在尝试在跨平台的xamarin应用程序中使用FFImageLoading。
I followed the instructions, and installed the Xamarin.FFImageLoading and Xamarin.FFImageLoading.Forms in both the android and IOS projects. 我按照说明进行操作,并在android和IOS项目中都安装了Xamarin.FFImageLoading和Xamarin.FFImageLoading.Forms。
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. 我还没有尝试过IOS。 Not a priority.
不是优先事项。
I have the following XAML just to see if it works: 我有以下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">
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. 我怀疑智能感知会陷入一个缺少
using
,并且在编译过程没有错误,上面只有一个,在运行时。
What have I done wrong!? 我做错了什么!
只需清理项目并重建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.