question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoClassDefFoundError when Fresco.initialize(this)

See original GitHub issue

Description

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)

Reproduction

Please checkout to master branch, compile, and run in emulator or Android device.

Solution

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.

Additional Information

  • Fresco version: 1.11.0
  • Platform version: Android Emulator API 27

Related with #2194

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
OzzieOrcacommented, Jun 5, 2019

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.

1reaction
oprisnikcommented, Feb 7, 2019

Please enable Jetifier as mentioned above if you hit this issue. Thanks @JesseBuss for the solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - java.lang.NoClassDefFoundError: com.facebook ...
I'm trying to use Fresco but it crashes as soon as I try to initialize it. I use Android Studio and I've been...
Read more >
java.lang.NoClassDefFoundError when Fresco.initialize(this)
java.lang.NoClassDefFoundError when Fresco.initialize(this) 问题描述: 使用fresco,implementati...
Read more >
HUAWEI PE-CL00 4.4 版本报错定位在application 的Fresco ...
java.lang.NoClassDefFoundError: com.facebook.imagepipeline.producers.HttpUrlConnectionNetworkFetcher at com.facebook.imagepipeline.core.
Read more >
Adding Flipper to Android apps with Gradle
To set up Flipper for Android, you need to add the necessary dependencies to your app, initialize the Flipper client and enable the...
Read more >
lg.java - 麻豆.apk源代码分析 - 摸瓜
te.u(a, "Fresco has already been initialized! `Fresco.initialize(...)` should only be called 1 single time to avoid memory leaks!");. } else {. c =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found