Glide 4.10.0 : java.lang.IllegalStateException: GeneratedAppGlideModuleImpl 实现不正确

Moh*_*had 17 android android-glide appglidemodule

使用Glide 4.10.0时出现错误

这是错误

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.

Run Code Online (Sandbox Code Playgroud)

Pra*_*ani 13

第一件事:

您是否更改了annotationProcessor依赖项:

implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
Run Code Online (Sandbox Code Playgroud)

此外,实现和 annotationProcessor 版本号相同也很重要。 Gradle 会自动更新第一个而不是第二个。

第二件事:

您是否添加了如下 proguard 规则:

-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 *;
}
Run Code Online (Sandbox Code Playgroud)

希望它会帮助你。谢谢你。


Sim*_*mon 6

就我而言,当我尝试在我的应用中显示 Google 地图时发生了此错误。特别是google-map-v3-betaSDK。

看起来 SDK 包含一个混淆版本的 Glide,当应用程序也使用 Glide 并且最终的 AndroidManifest.xml 包含一个名为“GlideModule”的元数据元素时,该版本会中断。

谷歌跟踪器中有一个问题:https : //issuetracker.google.com/issues/132323222

我的解决方案是切换回地图 v2。

  • 已经过去2年了,问题依然存在。 (2认同)

Yaz*_*dEF 6

我的应用程序也遇到了类似的问题。我将 Glide 库从 4.9.0 升级到 4.11.0。

前:

implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation ('com.github.bumptech.glide:okhttp3-integration:4.9.0'){
    exclude group: 'glide-parent'
}
Run Code Online (Sandbox Code Playgroud)

后:

implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation ('com.github.bumptech.glide:okhttp3-integration:4.11.0'){
    exclude group: 'glide-parent'
}
Run Code Online (Sandbox Code Playgroud)

这解决了问题。