Glide 4.4 java.lang.AbstractMethodError

时间:2017-12-23 19:32:34

标签: android android-glide

我在滑行时遇到超时异常,所以我试图增加时间。完成后,它给出了 AbstractMethodError

class com.bumptech.glide.load.engine.GlideException: Failed to load resource
                                                               Cause (1 of 1): class java.lang.AbstractMethodError: abstract method "com.bumptech.glide.load.model.ModelLoader com.bumptech.glide.load.model.ModelLoaderFactory.build(com.bumptech.glide.load.model.MultiModelLoaderFactory)"

我使用过的代码,我在下面提到了

dependencies {
compile 'com.github.bumptech.glide:glide:4.4.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
    compile 'com.github.bumptech.glide:okhttp3-integration:1.5.0@aar'
} 

@GlideModule
public final class MyAppGlideModule extends AppGlideModule {
    @Override
    public void registerComponents(Context context, Glide glide, Registry registry) {
        super.registerComponents(context, glide, registry);
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        builder.readTimeout(30, TimeUnit.SECONDS);
        builder.writeTimeout(30, TimeUnit.SECONDS);
        builder.connectTimeout(30, TimeUnit.SECONDS);
        registry.append(GlideUrl.class, InputStream.class,
                new OkHttpUrlLoader.Factory(builder.build()));
    }
    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }
}

1 个答案:

答案 0 :(得分:1)

添加或更改okhttp3-integration:4.4.0版本

  implementation ('com.github.bumptech.glide:okhttp3-integration:4.4.0'){
        exclude group: 'glide-parent'
    }