android – 因上下文4.3.1而滑行崩溃

在Glide 4.3的新版本中,我试图使用它,但每当我使用它以及我传递给它的任何上下文时它都会崩溃.

这是向我展示的错误

java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context,com.bumptech.glide.Glide,com.bumptech.glide.Registry)"

这是我试过的代码

Glide.with(getApplicationContext()).
            load(url)
            .into(imageView);

Glide.with(getContext()).
            load(url)
            .into(imageView);

它给了我那个警告

W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored

和gradle中的lib代码

compile 'com.github.bumptech.glide:glide:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'

Update1:
通过添加扩展AppGlideModule的类来解决问题

import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}

但同样的错误仍然存​​在

解决方法

请在AppGlideModule类上添加以下方法
@Override
public boolean isManifestParsingEnabled() {
  return false;
}

To maintain backward compatibility with Glide v3’s GlideModules,Glide still parses AndroidManifest.xml files from both the application and any included libraries and will include any legacy GlideModules listed in the manifest. Although this functionality will be removed in a future version,we’ve retained the behavior for Now to ease the transition.
If you’ve already migrated to the Glide v4 AppGlideModule and LibraryGlideModule,you can disable manifest parsing entirely. Doing so can improve the initial startup time of Glide and avoid some potential problems with trying to parse Metadata. To disable manifest parsing,override the isManifestParsingEnabled() method in your AppGlideModule implementation

检查:http://bumptech.github.io/glide/doc/configuration.html

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...