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

Glide 4.10.0 : java.lang.IllegalStateException: GeneratedAppGlideModuleImpl is implemented incorrectly

我在使用 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.

第一件事:

你有没有改变annotationProcessor依赖:

implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

此外,重要的是实现和注释处理器版本号相同。 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 *;
}

希望对您有所帮助。谢谢。

就我而言,当我试图在我的应用程序中显示 Google 地图时,这个错误发生了。 特别是 google-map-v3-beta SDK。

It looks like the SDK contains an obfuscated version of Glide that breaks when the app also uses Glide and the final AndroidManifest.xml contains a meta-data element called "GlideModule".

google 跟踪器中存在一个问题:https://issuetracker.google.com/issues/132323222

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

我的应用程序遇到了类似的问题。我将 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'
}

之后:

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'
}

这解决了问题。

我也有这个错误。可能您正在使用的库使用了另一个 Glide 版本,因此您应该使用与您的库使用的 Glide 库版本相同的库。

只需要在glide中将版本编译器设置为相同的版本即可 实施 'com.github.bumptech.glide:glide:4.11.0' 开普 'com.github.bumptech.glide:compiler:4.11.0'

将此添加到 android/build.gradle.

  buildscript {
   ext {
    excludeAppGlideModule = true
   }

link:

https://github.com/DylanVann/react-native-fast-image/issues/670 https://github.com/DylanVann/react-native-fast-image/issues/318