Xamarin Android Lib绑定Glide ClassCast异常

奥列西·穆拉维约夫(Olexii Muraviov)

我有一个使用Glide进行图像加载的Android库。Glide生成一些类,例如GlideAppGlideRequests等。在我的库中,Glide用于:

GlideApp.with(view)...

所产生的GlideApp类的方法是这样的代码:

 public static GlideRequests with(View view) {
    return (GlideRequests) Glide.with(view);
 }

其中GlideRequests也由Glide类生成。

我为aar库创建了Xamarin绑定,还包括来自NuGet的Glide绑定。但是当在库代码中调用GlideApp.with(view)...方法时,Xamarin给了我一个例外:

Java.Lang.ClassCastException: com.bumptech.glide.RequestManager cannot be cast to 
  com.photobutler.android.pbsdk.presentation.glide.GlideRequests
  at java.lang.ClassCastException: com.bumptech.glide.RequestManager cannot be 
  cast to com.photobutler.android.pbsdk.presentation.glide.GlideRequests
  at at com.photobutler.android.pbsdk.presentation.glide.GlideApp.with(...)

GlideRequestsRequestManager的子类

public class GlideRequests extends RequestManager {...}

所以一切都应该没问题,但是我遇到了例外。有人可以帮我找到解决方案吗?

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章