java在AndroidX中实现Glide 4.10.0时发生错误AppGlideModuleImpl实现不正确
我在AndroidX中实现Glide 4.10.0时遇到了问题,我遵循了文档,但仍然出错。请帮我学滑翔
我的程序规则。专业代码
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
我的身材。格雷德尔码
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
我的代码
Glide.with(ctx).load("https://lh6.ggpht.com/9SZhHdv4URtBzRmXpnWxZcYhkgTQurFuuQ8OR7WZ3R7fyTmha77dYkVvcuqMu3DLvMQ=w300").into(img);
错误消息
W/System.err: java.lang.IllegalStateException: GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.
at com.bumptech.glide.Glide.throwIncorrectGlideModule(Glide.java:341)
at com.bumptech.glide.Glide.getAnnotationGeneratedGlideModules(Glide.java:333)
at com.bumptech.glide.Glide.get(Glide.java:176)
at com.bumptech.glide.Glide.getRetriever(Glide.java:714)
at com.bumptech.glide.Glide.with(Glide.java:741)
at com.ind.projecttest.util.Tools.displayCircularImageViewOriginal(Tools.java:62)
at com.ind.projecttest.activity.MainActivity.setupLayoutValue(MainActivity.java:101)
at com.ind.projecttest.activity.MainActivity.access$500(MainActivity.java:54)
at com.ind.projecttest.activity.MainActivity$4.onResponse(MainActivity.java:305)
at com.ind.projecttest.activity.MainActivity$4.onResponse(MainActivity.java:296)
at com.安卓.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:90)
at com.安卓.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:102)
W/System.err: at 安卓.os.Handler.handleCallback(Handler.java:873)
at 安卓.os.Handler.dispatchMessage(Handler.java:99)
at 安卓.os.Looper.loop(Looper.java:201)
at 安卓.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.安卓.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NoSuchMethodException: <init> [class 安卓.content.Context]
at java.lang.Class.getConstructor0(Class.java:2327)
at java.lang.Class.getDeclaredConstructor(Class.java:2166)
at com.bumptech.glide.Glide.getAnnotationGeneratedGlideModules(Glide.java:317)
... 17 more
I/f.indsmartmobil: ProcessProfilingInfo new_methods=1978 is saved saved_to_disk=1 resolve_classes_delay=8000
W/DpmTcmClient: read failed bytes countRead: -1
# 1 楼答案
在我的自定义AppGlideModule类中添加@Keep注释对我很有用