React Native - Android 动画 WebP 不工作

React Native - Android Animated WebP is not working

我正在尝试在 android 设备上播放动画 webp 文件。我正在使用 react-native-animated-webp 包,但在构建应用程序时出现错误。

当我将以下行添加到 app/build.gradle 文件中时:

 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'

我遇到了这个错误:

* 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)

有没有人以前遇到过这个问题?我该如何解决?

我将 Flipper 版本升级到 FLIPPER_VERSION=0.99.0,然后将 Fresco 版本从 2.0.0 升级到 2.5.0,然后 cd android && ./gradlew clean 它对我有用