GlideV4 AbstractMethodError解决方案

GlideV4 AbstractMethodError解决方案昨天升级glide最新包遇到的问题,看了一下官网的解决方案 https://github.com/bumptech/glide集成4.x报错信息java.lang.AbstractMethodError:abstractmethod"voidcom.bumptech.glide.module.RegistersComponents.registerComponents(and…

大家好,又见面了,我是你们的朋友全栈君。

昨天升级glide最新包遇到的问题,看了一下官网的解决方案 

https://github.com/bumptech/glide

集成4.x报错信息

java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Glide, com.bumptech.glide.Registry)"
                                                                 at com.bumptech.glide.Glide.initializeGlide(Glide.java:236)
                                                                 at com.bumptech.glide.Glide.checkAndInitializeGlide(Glide.java:176)
                                                                 at com.bumptech.glide.Glide.get(Glide.java:160)
                                                                 at com.bumptech.glide.Glide.getRetriever(Glide.java:583)
                                                                 at com.bumptech.glide.Glide.with(Glide.java:632)
                                                                 at briefer.pet.ui.activity.MainActivity.setPersonalData(MainActivity.java:715)
                                                                 at briefer.pet.ui.activity.MainActivity.initData(MainActivity.java:227)
                                                                 at briefer.pet.ui.activity.MainActivity.onCreate(MainActivity.java:220)
                                                                 at android.app.Activity.performCreate(Activity.java:6910)
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
                                                                 at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                 at android.os.Looper.loop(Looper.java:156)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:6523)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

需要新建一个MyAppGlideModule


import android.content.Context;

import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.module.AppGlideModule;
import com.bumptech.glide.request.RequestOptions;

@GlideModule
public class MyAppGlideModule extends AppGlideModule {
//    @Override
//    public boolean isManifestParsingEnabled() {
//        return false;
//    }
    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));
    }
}

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/137319.html原文链接:https://javaforall.net

(0)
上一篇 2022年6月2日 上午9:16
下一篇 2022年6月2日 上午9:16


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号