React Native Android构建失败

8

在使用 Android Studio 构建 React Native 项目时,我遇到了这个错误。该如何解决并去除重复项。

 Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector found in modules imagepipeline-base-2.2.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.2.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.2.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.2.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.2.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.2.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)

1
你能试试这个吗: https://github.com/facebook/flipper/issues/660#issuecomment-565119057 - FreakyCoder
我尝试了那个建议,但他们似乎在flipper方面有问题。我的项目在使用fresco时出现了问题。我不确定如何以正确的格式删除该软件包。 - forests
您有降级到RN 0.61.5的机会吗? - FreakyCoder
哦 :( 一些UI套件真是让人头疼。 - FreakyCoder
你找到这个问题的解决方案了吗? - ThinkAndCode
显示剩余3条评论
3个回答

8

当我将我的React Native项目升级到'0.68.2'时,出现了类似的错误。

通过更新Flipper SDK版本来解决问题。 Flipper版本为'0.33.1',将其更改为'0.99.0'。

来源


在 React Native 0.65 上对我有效。 - P. Navarro
对我也起作用了,更新到0.65版本。 - undefined

6

这似乎是Flipper和Fresco之间的冲突引起的。请将以下内容添加到应用级别的build.gradle文件中:

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.fbjni'
    exclude group:'com.facebook.fresco'
}

1
这个解决方案没有解决我的问题。事实上,我在此之后遇到了很多问题。有其他的建议吗? - ThinkAndCode

4

我也遇到了相同的错误。从 package.json 中移除以下代码后,我的依赖项就正常工作了:

"react-native-photo-view": "github:shoutem/react-native-photo-view#0ffa1481f6b6cb8663cb291b7db1d6644440584d"

我不是很确定为什么,但可能是因为那里存在重复。


当然!很高兴能帮忙。 - Christopher Lim

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接