-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Compose] Preview does not work with GlideImage #4977
Comments
I can't trivially reproduce this error in Glide's HorizontalGalleryFragment:
Produces: |
In the sunflower app though, I see a slightly different error:
|
I think the stack trace I posted is the correct error. There's a static variable that's set and rest but not using a try/finally. That could cause two attempts to initialize Glide concurrently to both throw but with different causes. Assuming the preview ever does this, it would explain why there are two different stack traces. So there's two, or maybe three bugs:
glide/library/src/main/java/com/bumptech/glide/Glide.java Lines 149 to 151 in 464002b
In the meantime, you can work around this by disabling legacy manifest parsing:
@GlideModule class AppGlideModule() {
fun isManifestParsingEnabled = false
} |
Yeah actually I think the root cause is actually point #3 above, PackageManager.getApplicationInfo is annotated with Still worth fixing the initialization error in Glide though, that'll at least make the root cause more clear. |
Filed b/263613353 internally. I also wrote a workaround in Glide, but I'll avoid submitting it until we understand better how long a fix in the tooling will take. |
https://github.com/sjudd/glide/tree/manifest_parser_null_app_info is the workaround for null application info |
Previously any exception in the initialization process could be hidden by one of these recursive checks. The first time the exception occured, it would be thrown normally, but subsequent times the recursive check would be thrown instead. This complicates debugging. Now we always unset the isInitializing boolean using try/finally. While this doesn't fix anything directly, it does make debugging easier when some kind of initialization error occurs. Helps with bumptech#4977
Previously any exception in the initialization process could be hidden by one of these recursive checks. The first time the exception occured, it would be thrown normally, but subsequent times the recursive check would be thrown instead. This complicates debugging. Now we always unset the isInitializing boolean using try/finally. While this doesn't fix anything directly, it does make debugging easier when some kind of initialization error occurs. Helps with bumptech#4977
Thanks so much for looking into this @sjudd! 🙏 |
Looks like there's no movement on fixing the issue in ASWB, so I'll submit the workaround. |
I'm working with GlideImage 1.0.0-alpha.3 and Glide 4.15.1, which should have the above fix, but I still see that Compose Previews fail to render when using GlideImage. The stack trace looks to be in a similar place as one from above:
Any thoughts on this new exception? |
Hi, |
Hi. |
We are having the same issue as @mattcollins107. Just FYI for us this only happens with AS Flamingo releases or newer. If you want to avoid this issue revert back to using AS EE. FYI @sjudd |
Same error on Hedgehog |
Can we expect 0f9aea2 this commit should fix this issue? |
We should downgrade our AS to use glide :) It's awful |
… composable. The SunflowerImage() wrapper was introduced as a workaround for the issue bumptech/glide#4977, and now that the issue has been resolved, there is no need for this wrapper in the codebase. Others minor changes: - Simplified expression if (plant != null && isPlanted != null && showSnackbar != null) to if (plant != null && showSnackbar != null) as (isPlanted != null) is always true. - Replaced deprecated Icons.Filled.ArrowBack with Icons.AutoMirrored.Filled.ArrowBack.
… composable. (#945) The SunflowerImage() wrapper was introduced as a workaround for the issue bumptech/glide#4977, and now that the issue has been resolved, there is no need for this wrapper in the codebase. Others minor changes: - Simplified expression if (plant != null && isPlanted != null && showSnackbar != null) to if (plant != null && showSnackbar != null) as (isPlanted != null) is always true. - Replaced deprecated Icons.Filled.ArrowBack with Icons.AutoMirrored.Filled.ArrowBack. Co-authored-by: Chris Arriola <[email protected]>
Glide Version: 1.0.0-alpha.1
Integration libraries: compose
Device/Android Version: emulator
GlideImage
does not work with composable previews. The following code:...triggers this stracktrace:
You can also validate this in the Sunflower sample app which has a
GlideImage
in its UI hierarchy: https://github.com/android/sunflower/blob/main/app/src/main/java/com/google/samples/apps/sunflower/compose/plantdetail/PlantDetailView.kt#L553The text was updated successfully, but these errors were encountered: