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

前端之家收集整理的这篇文章主要介绍了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

原文链接:https://www.f2er.com/android/315513.html

猜你在找的Android相关文章