Search code examples
androidreact-nativewebp

React Native - Android Animated WebP is not working


I am trying to play an animated webp file on android devices. I am using react-native-animated-webp package but I got an error while building the app.

When I added the following lines into app/build.gradle file:

 implementation("com.facebook.fresco:fresco:2.0.0")
 // For animated GIF support
 implementation 'com.facebook.fresco:animated-gif:2.0.0'
 // For WebP support, including animated WebP
 implementation 'com.facebook.fresco:animated-webp:2.3.0'
 implementation 'com.facebook.fresco:webpsupport:2.3.0'

I got this error :

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
  Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfo found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
  Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfoEntry found in modules imagepipeline-base-2.3.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.3.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)

Is there anyone who faced this issue before? How can I solve it?


Solution

  • I upgraded Flipper Version to FLIPPER_VERSION=0.99.0 then Fresco version from 2.0.0 to 2.5.0 then cd android && ./gradlew clean it worked for me