这是向我展示的错误
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