Hi, I have created a simple project https://github.com/shinwan2/SimpleFrescoApp. At master branch, running the app will trigger a crash on Fresco.initialize(this).
Here is the relevant stacktrace
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/Pools$SynchronizedPool;
at com.facebook.imagepipeline.core.ImagePipelineFactory.buildPlatformDecoder(ImagePipelineFactory.java:337)
at com.facebook.imagepipeline.core.ImagePipelineFactory.getPlatformDecoder(ImagePipelineFactory.java:356)
at com.facebook.imagepipeline.core.ImagePipelineFactory.getPlatformBitmapFactory(ImagePipelineFactory.java:319)
at com.facebook.imagepipeline.core.ImagePipelineFactory.getAnimatedFactory(ImagePipelineFactory.java:163)
at com.facebook.imagepipeline.core.ImagePipelineFactory.getImageDecoder(ImagePipelineFactory.java:222)
at com.facebook.imagepipeline.core.ImagePipelineFactory.getProducerFactory(ImagePipelineFactory.java:372)
at com.facebook.imagepipeline.core.ImagePipelineFactory.getProducerSequenceFactory(ImagePipelineFactory.java:402)
at com.facebook.imagepipeline.core.ImagePipelineFactory.getImagePipeline(ImagePipelineFactory.java:279)
at com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilderSupplier.<init>(PipelineDraweeControllerBuilderSupplier.java:51)
at com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilderSupplier.<init>(PipelineDraweeControllerBuilderSupplier.java:42)
at com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilderSupplier.<init>(PipelineDraweeControllerBuilderSupplier.java:35)
at com.facebook.drawee.backends.pipeline.Fresco.initializeDrawee(Fresco.java:96)
at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:85)
at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:38)
Please checkout to master branch, compile, and run in emulator or Android device.
Fresco (com.facebook.imagepipeline) needs additional dependency to android.support.v4.util.Pools.SynchronizedPool which based on this should be in com.android.support:support-compat:28.0.0.
Related with #2194
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions.
Thanks for the bug report. Please add implementation 'com.android.support:support-compat:28.0.0' as a dependency to your application. I just tested with your sample app and adding this fixes the problem for now.
I had this same error and took a long time to figure it out. In gradle.properties I had
android.enableJetifier = false
Settings it to true fixed it for me.
@JesseBuss did you add it to your project's gradle.properties or to Fresco's grade.properties?
@tgehrs my own
Please enable Jetifier as mentioned above if you hit this issue. Thanks @JesseBuss for the solution.
I started getting this error with fresco 1.14.0 and 1.14.1. I had added implementation 'com.facebook.fresco:fresco:1.+' to fix images not loading with React Native 0.59.8. The + started picking up these new versions that aren't in the changelog. It appears that v1.14.0 migrated to androidx https://github.com/facebook/fresco/compare/b59414a97b6fc37269985f6d8b111b756fc42464...v1.14.0.
Downgrading to 1.13.0 with implementation 'com.facebook.fresco:fresco:1.13.0' fixed it for now. Once React Native 0.60.0 lands with androidx support, hopefully the newer versions will work too.
@OzzieOrca your solution worked for us, thank you!
We're on React Native v0.57
We also had implementation 'com.facebook.fresco:animated-gif:1.+' in build.gradle, after setting it to implementation 'com.facebook.fresco:animated-gif:1.13.0' we were able to build apk.
Information about animated-gif part: react-native issue
Most helpful comment
I started getting this error with fresco
1.14.0and1.14.1. I had addedimplementation 'com.facebook.fresco:fresco:1.+'to fix images not loading with React Native0.59.8. The+started picking up these new versions that aren't in the changelog. It appears that v1.14.0 migrated to androidx https://github.com/facebook/fresco/compare/b59414a97b6fc37269985f6d8b111b756fc42464...v1.14.0.Downgrading to
1.13.0withimplementation 'com.facebook.fresco:fresco:1.13.0'fixed it for now. Once React Native0.60.0lands with androidx support, hopefully the newer versions will work too.