这是向我展示的错误
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 {}
但同样的错误仍然存在
解决方法
@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
原文地址:https://www.jb51.cc/android/315513.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。