Status Update
Comments
sh...@google.com <sh...@google.com> #2
To investigate further, can you share more details on your use case where you are using the Glide? Kindly also note that Glide is "An image loading and caching library for Android focused on smooth scrolling", this may have implementations against the Terms of Service of Google Maps Platform[1] under "3.2.4(b) No Caching. Customer will not cache Google Maps Content except as expressly permitted under the Maps Service Specific Terms.".
Kindly review the ToS of Google Maps Platform, once confirmed that your use case is compliant, we will be glad to proceed with the investigation.
[1]
ta...@appcorner.eu <ta...@appcorner.eu> #3
be...@citymapper.com <be...@citymapper.com> #4
java.lang.ClassCastException: com.bumptech.glide.GeneratedAppGlideModuleImpl cannot be cast to com.google.android.libraries.maps.c.zza
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:96)
at com.google.android.libraries.maps.c.zzb.zza(Glide.java:11)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:218)
at com.google.android.libraries.maps.cf.zzi.zza(ResourceManagerImpl.java:7)
at com.google.android.libraries.maps.hi.zzas.zza(Suppliers.java:7)
at com.google.android.libraries.maps.cf.zzf.run(Unknown Source:7)
at com.google.android.libraries.maps.fc.zzc.run(CancelableRunnable.java:7)
at com.google.android.libraries.maps.fc.zzad.run(Task.java:9)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.libraries.maps.fc.zzv.run(GmmThread.java:10)
at java.lang.Thread.run(Thread.java:919)
Glide in the maps SDK still tries to find the generated module by its non-shaded name, with and then tries to cast it to the shaded class, which blows up:
(com.google.android.libraries.maps.c.zza) Class.forName("com.bumptech.glide.GeneratedAppGlideModuleImpl")
jh...@google.com <jh...@google.com>
yo...@gmail.com <yo...@gmail.com> #5
sh...@google.com <sh...@google.com> #6
[Deleted User] <[Deleted User]> #7
jh...@google.com <jh...@google.com> #8
wa...@google.com <wa...@google.com> #9
ki...@gmail.com <ki...@gmail.com> #10
Does anyone else facing this issue have a workaround they've implemented in the meantime? Aside from pulling out Glide from your project...
ga...@gmail.com <ga...@gmail.com> #11
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation ('com.github.bumptech.glide:okhttp3-integration:4.9.0') {
exclude group: 'glide-parent'
}
implementation ('com.github.bumptech.glide:annotations:4.9.0')
implementation name:'maps-sdk-3.0.0-beta', ext:'aar'
Stack trace:
java.lang.IllegalStateException: tname=DefaultPool6 - GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:103)
at com.google.android.libraries.maps.c.zzb.zza(Glide.java:11)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:218)
at com.google.android.libraries.maps.cf.zzi.zza(ResourceManagerImpl.java:7)
at com.google.android.libraries.maps.hi.zzas.zza(Suppliers.java:7)
at com.google.android.libraries.maps.cf.zzf.run(Unknown Source)
at com.google.android.libraries.maps.fc.zzc.run(CancelableRunnable.java:7)
at com.google.android.libraries.maps.fc.zzad.run(Task.java:9)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.google.android.libraries.maps.fc.zzv.run(GmmThread.java:10)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalAccessException: java.lang.Class<com.bumptech.glide.GeneratedAppGlideModuleImpl> is not accessible from java.lang.Class<com.google.android.libraries.maps.c.zzb>
at java.lang.reflect.Constructor.newInstance(Native Method)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:96)
ar...@gmail.com <ar...@gmail.com> #12
yu...@gmail.com <yu...@gmail.com> #13
ka...@gmail.com <ka...@gmail.com> #14
[Deleted User] <[Deleted User]> #15
apparently the issue is that newer glide versions will generate a com.bumptech.glide.GeneratedAppGlideModuleImpl class with context inside constructor
and google maps 3 will try to instantiate without passing the constructor -> hence the reflection exception. not sure how to fix that from the outside though, it would help if we knew the actual glide version they're using
here the glide generated class glide:
com.github.bumptech.glide:glide:4.11.0 com.github.bumptech.glide:compiler:4.11.0
@SuppressWarnings("deprecation")
final class GeneratedAppGlideModuleImpl extends GeneratedAppGlideModule {
private final AppGlideModule appGlideModule;
public GeneratedAppGlideModuleImpl(Context context) {
appGlideModule = new AppGlideModule();
if (Log.isLoggable("Glide", Log.DEBUG)) {
Log.d("Glide", "Discovered AppGlideModule from annotation: com.europapark.services.glide.AppGlideModule");
Log.d("Glide", "Discovered LibraryGlideModule from annotation: com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule");
Log.d("Glide", "Discovered LibraryGlideModule from annotation: net.kibotu.mediagallery.internal.progress.GlideConfiguration");
}
}
@Override
public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
appGlideModule.applyOptions(context, builder);
}
@Override
public void registerComponents(@NonNull Context context, @NonNull Glide glide,
@NonNull Registry registry) {
new OkHttpLibraryGlideModule().registerComponents(context, glide, registry);
new GlideConfiguration().registerComponents(context, glide, registry);
appGlideModule.registerComponents(context, glide, registry);
}
@Override
public boolean isManifestParsingEnabled() {
return appGlideModule.isManifestParsingEnabled();
}
@Override
@NonNull
public Set<Class<?>> getExcludedModuleClasses() {
return Collections.emptySet();
}
@Override
@NonNull
GeneratedRequestManagerFactory getRequestManagerFactory() {
return new GeneratedRequestManagerFactory();
}
}
and here the call within the gmaps 3 library
private static com.google.android.libraries.maps.c.zza zzb() {
com.google.android.libraries.maps.c.zza var0 = null;
try {
var0 = (com.google.android.libraries.maps.c.zza)Class.forName("com.bumptech.glide.GeneratedAppGlideModuleImpl").getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException var2) {
if (Log.isLoggable("Glide", 5)) {
Log.w("Glide", "Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored");
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException | InstantiationException var3) {
throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", var3);
}
return var0;
}
[Deleted User] <[Deleted User]> #16
cu...@gmail.com <cu...@gmail.com> #17
da...@gmail.com <da...@gmail.com> #18
This is still happening with glide 4.11.0
av...@atly.com <av...@atly.com> #19
We tried understanding the issue, it seems that a glide module is generated through reflection:
Some thing like this
try {
var0 = (com.google.android.libraries.maps.c.zza)Class.forName("com.bumptech.glide.GeneratedAppGlideModuleImpl").getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException var2) {
if (Log.isLoggable("Glide", 5)) {
Log.w("Glide", "Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored");
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException | InstantiationException var3) {
throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", var3);
}
Glide has a constructor of this method with context, but google tries to create an instance of this class without any parameters, that is why an exception is occurred.
Someone can think of a workaround or time till this is fixed?
jh...@google.com <jh...@google.com> #20
je...@gmail.com <je...@gmail.com> #21
ma...@gmail.com <ma...@gmail.com> #22
jh...@google.com <jh...@google.com>
[Deleted User] <[Deleted User]> #23
The actual problem here is that Glide generates GeneratedAppGlideModuleImpl
as package-private and when maps tries to use its own obfuscated, repackaged version of Glide to read it it blows up because its accessing it from a different package. If you look at the original issue the root cause is an IllegalAccessException
.
The real question is: why not just depend on Glide?
cl...@gmail.com <cl...@gmail.com> #24
jo...@getstream.io <jo...@getstream.io> #25
The Maps SDK 3.1.0-beta is not able to access to the constructor of GeneratedAppGlideModuleImpl
, if you call the reflection method isAccessible()
you will get false
So you need to fix it into Maps SDK.
I have done some tests and you should be able to write some code like:
@Nullable
private static com.google.android.libraries.maps.c.zza zzc(Context var0) {
com.google.android.libraries.maps.c.zza var1 = null;
try {
Constructor<?> constructor = Class.forName("com.bumptech.glide.GeneratedAppGlideModuleImpl").getDeclaredConstructor(Context.class);
constructor.setAccessible(true);
var1 = constructor.newInstance(var0.getApplicationContext());
} catch (ClassNotFoundException var3) {
if (Log.isLoggable("Glide", 5)) {
Log.w("Glide", "Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored");
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException | InstantiationException var4) {
throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", var4);
}
return var1;
}
sk...@gmail.com <sk...@gmail.com> #26
Is it something you've been working or you'll be working on soon?
gm...@googlemail.com <gm...@googlemail.com> #27
gu...@gmail.com <gu...@gmail.com> #28
2020-10-26 20:02:59.828 8739-16763/? E/AndroidRuntime: FATAL EXCEPTION: DefaultPool2
Process:
java.lang.RuntimeException: Expected instanceof GlideModule, but found: com.foo.BarGlideModule@81c319a
at com.google.android.libraries.maps.w.zzd.zza(ManifestParser.java:39)
at com.google.android.libraries.maps.w.zzd.zza(ManifestParser.java:18)
at com.google.android.libraries.maps.c.zzb.zza(Glide.java:14)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:240)
at com.google.android.libraries.maps.cq.zzh.zza(ResourceManagerImpl.java:7)
at com.google.android.libraries.maps.ij.zzaw.zza(Suppliers.java:7)
at com.google.android.libraries.maps.cq.zzi.run(Unknown Source:8)
at com.google.android.libraries.maps.fv.zzc.run(CancelableRunnable.java:7)
at com.google.android.libraries.maps.fv.zzae.run(Task.java:9)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.libraries.maps.fv.zzv.run(GmmThread.java:10)
at java.lang.Thread.run(Thread.java:919)
fr...@appetiser.com.au <fr...@appetiser.com.au> #29
Process: com.hevo, PID: 11001
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.google.android.libraries.maps.c.zzb.zzc(Glide.java:108)
at com.google.android.libraries.maps.c.zzb.zza(Glide.java:3)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:240)
at com.google.android.libraries.maps.cq.zzh.zza(ResourceManagerImpl.java:7)
at com.google.android.libraries.maps.ij.zzaw.zza(Suppliers.java:7)
at com.google.android.libraries.maps.cq.zzi.run(Unknown Source:8)
at com.google.android.libraries.maps.fv.zzc.run(CancelableRunnable.java:7)
at com.google.android.libraries.maps.fv.zzae.run(Task.java:9)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.android.libraries.maps.fv.zzv.run(GmmThread.java:10)
at java.lang.Thread.run(Thread.java:764)
used glide 4.11.0 and google maps 3.1.0-beta
I'm not sure if this is also relevant but i also use google places 2.4.0.
[Deleted User] <[Deleted User]> #30
Only now I decide to checkout google maps v3 since I want to use it in Compose.... but this is great.... (together the use of the support lib)
gu...@gmail.com <gu...@gmail.com> #31
ab...@gmail.com <ab...@gmail.com> #32
I just integrated and was trying out maps v3 since I was facing OOM issues in v2 and ended up with this issue. Almost every developer I know uses Glide. If this issue is not fixed, will have to abandon the upgrade to v3. Team, please prioritise this and fix it. Thanks.
lu...@gmail.com <lu...@gmail.com> #33
fo...@gmail.com <fo...@gmail.com> #34
ni...@gmail.com <ni...@gmail.com> #35
[Deleted User] <[Deleted User]> #36
ma...@google.com <ma...@google.com> #37
Thanks for patiently waiting.
Maps SDK for Android Beta version is now deprecated and will be fully decommissioned in late 2022. For more information, you can check our documentation here:
Google has released a new client library for Maps SDK for Android, version 18.0.0 that we suggest that you try. You can also migrate your Beta SDK version to the latest version by using our migration tool here:
If you have any issues using the latest version of the SDK, please let us know by either:
Description
Steps to reproduce:
1) Build a sample app using Maps SDK v3.0.0 Beta
2) Add 'com.github.bumptech.glide:glide:4.9.0' and 'com.github.bumptech.glide:okhttp3-integration:4.9.0' dependencies to the app-level build.gradle file
3) The app crashes with the following exception the first time a map is shown:
2019-05-09 14:08:35.613 30627-30691/? E/AndroidRuntime: FATAL EXCEPTION: DefaultPool6
Process: eu.appcorner.mapsv3.glideokhttpcrash, PID: 30627
java.lang.RuntimeException: Expected instanceof GlideModule, but found: com.bumptech.glide.integration.okhttp3.OkHttpGlideModule@679a3f
at com.google.android.libraries.maps.w.zzf.zza(ManifestParser.java:38)
at com.google.android.libraries.maps.w.zzf.zza(ManifestParser.java:17)
at com.google.android.libraries.maps.c.zzb.zza(Glide.java:13)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:218)
at com.google.android.libraries.maps.cf.zzi.zza(ResourceManagerImpl.java:7)
at com.google.android.libraries.maps.hi.zzas.zza(Suppliers.java:7)
at com.google.android.libraries.maps.cf.zzf.run(Unknown Source:7)
at com.google.android.libraries.maps.fc.zzc.run(CancelableRunnable.java:7)
at com.google.android.libraries.maps.fc.zzad.run(Task.java:9)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.libraries.maps.fc.zzv.run(GmmThread.java:10)
at java.lang.Thread.run(Thread.java:764)
Sample repo for this crash:
=======
A similar crash occurs when using custom glide modules:
E/AndroidRuntime: FATAL EXCEPTION: DefaultPool5
Process: eu.appcorner.mapsv3.glideokhttpcrash, PID: 31878
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.google.android.libraries.maps.c.zzb.zzb(Glide.java:103)
at com.google.android.libraries.maps.c.zzb.zza(Glide.java:11)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:218)
at com.google.android.libraries.maps.cf.zzi.zza(ResourceManagerImpl.java:7)
at com.google.android.libraries.maps.hi.zzas.zza(Suppliers.java:7)
at com.google.android.libraries.maps.cf.zzf.run(Unknown Source:7)
at com.google.android.libraries.maps.fc.zzc.run(CancelableRunnable.java:7)
at com.google.android.libraries.maps.fc.zzad.run(Task.java:9)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.libraries.maps.fc.zzv.run(GmmThread.java:10)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalAccessException: java.lang.Class<com.bumptech.glide.GeneratedAppGlideModuleImpl> is not accessible from java.lang.Class<com.google.android.libraries.maps.c.zzb>
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:96)
at com.google.android.libraries.maps.c.zzb.zza(Glide.java:11)
at com.google.android.libraries.maps.c.zzb.zzb(Glide.java:218)
at com.google.android.libraries.maps.cf.zzi.zza(ResourceManagerImpl.java:7)
at com.google.android.libraries.maps.hi.zzas.zza(Suppliers.java:7)
at com.google.android.libraries.maps.cf.zzf.run(Unknown Source:7)
at com.google.android.libraries.maps.fc.zzc.run(CancelableRunnable.java:7)
at com.google.android.libraries.maps.fc.zzad.run(Task.java:9)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.libraries.maps.fc.zzv.run(GmmThread.java:10)
at java.lang.Thread.run(Thread.java:764)
Sample repo for this crash:
Device: Pixel 3 XL, Android 9
Maps SDK Version: 3.0.0-beta (worked fine with v2)
Android SDK Version: 28