litho
litho copied to clipboard
Duplicate class com.facebook.yoga. while have litho and Jitsi in one project
Error
Duplicate class com.facebook.yoga.LayoutPassReason found in modules jetified-react-native-0.61.5-jitsi.1-runtime.jar (com.facebook.react:react-native:0.61.5-jitsi.1) and jetified-yoga-1.16.0-runtime.jar (com.facebook.yoga:yoga:1.16.0)
Duplicate class com.facebook.yoga.YogaAlign found in modules jetified-react-native-0.61.5-jitsi.1-runtime.jar (com.facebook.react:react-native:0.61.5-jitsi.1) and jetified-yoga-1.16.0-runtime.jar (com.facebook.yoga:yoga:1.16.0)
---
and much more with same modules
---
Go to the documentation to learn how to Fix dependency resolution errors.
Version
implementation 'com.facebook.litho:litho-core:0.33.0'
implementation 'com.facebook.litho:litho-widget:0.33.0'
annotationProcessor 'com.facebook.litho:litho-processor:0.33.0'
// SoLoader
implementation 'com.facebook.soloader:soloader:0.8.0'
// For integration with Fresco
implementation 'com.facebook.litho:litho-fresco:0.33.0'
// For testing
testImplementation 'com.facebook.litho:litho-testing:0.33.0'
implementation 'com.facebook.litho:litho-sections-core:0.33.0'
implementation 'com.facebook.litho:litho-sections-widget:0.33.0'
compileOnly 'com.facebook.litho:litho-sections-annotations:0.33.0'
annotationProcessor 'com.facebook.litho:litho-sections-processor:0.33.0'
implementation 'org.jitsi.react:jitsi-meet-sdk:2.9.3'
Issues and Steps to Reproduce
Just have Litho and Jitsi dependencies lead to this error.
Expected Behavior
Not crash at compile and runtime.
##Tried to add
configurations.all {
exclude group: 'com.facebook.yoga', module: 'yoga'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
But it leads to Error
FATAL EXCEPTION: main
Process: PID: 23002
com.facebook.litho.ComponentsChainException: RecyclerCollectionComponent
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/yoga/YogaConfigFactory;
at com.facebook.litho.yoga.LithoYogaFactory.createYogaConfig(LithoYogaFactory.java:26)
at com.facebook.litho.NodeConfig.<clinit>(NodeConfig.java:45)
at com.facebook.litho.InternalNodeUtils.create(InternalNodeUtils.java:26)
at com.facebook.litho.Column.resolve(Column.java:90)
at com.facebook.litho.LayoutState.resolve(LayoutState.java:2871)
at com.facebook.litho.LayoutState.createLayout(LayoutState.java:2763)
at com.facebook.litho.LayoutState.createLayout(LayoutState.java:1786)
at com.facebook.litho.LayoutState.createAndMeasureTreeForComponent(LayoutState.java:1983)
at com.facebook.litho.LayoutState.calculate(LayoutState.java:1461)
at com.facebook.litho.ComponentTree$LayoutStateFuture.calculateLayoutStateInternal(ComponentTree.java:2468)
at com.facebook.litho.ComponentTree$LayoutStateFuture.access$2600(ComponentTree.java:2386)
at com.facebook.litho.ComponentTree$LayoutStateFuture$1.call(ComponentTree.java:2446)
at com.facebook.litho.ComponentTree$LayoutStateFuture$1.call(ComponentTree.java:2438)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.facebook.litho.ComponentTree$LayoutStateFuture.runAndGetIncreasePriority(ComponentTree.java:2567)
at com.facebook.litho.ComponentTree$LayoutStateFuture.runAndGet(ComponentTree.java:2560)
at com.facebook.litho.ComponentTree.calculateLayoutState(ComponentTree.java:2351)
at com.facebook.litho.ComponentTree.measure(ComponentTree.java:1060)
at com.facebook.litho.LithoView.performLayout(LithoView.java:376)
at com.facebook.litho.ComponentHost.onLayout(ComponentHost.java:799)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:625)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:779)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3080)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2590)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
2020-08-26 18:29:13.879 23002-23002/co.E/AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:790)
at android.view.Choreographer.doFrame(Choreographer.java:725)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.yoga.YogaConfigFactory" on path: DexPathList[[zip file "/data/app/-OGJDgry3f2d_D4kS48h3AA==/base.apk"],nativeLibraryDirectories=[/data/app/co.roomapp.klassroom-OGJDgry3f2d_D4kS48h3AA==/lib/x86, /data/app/c-OGJDgry3f2d_D4kS48h3AA==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
Please help to fix this, thanks.
Conflict happens as jitsi has dependency on react native and both litho/react native have dependencies on Yoga. I tried to repro this locally by adding react native and litho dependency in a sample project and I was getting a similar error which was resolved by adding :
configurations.all { exclude group: 'com.facebook.yoga', module: 'yoga' }
I know you have already tried this and now you are getting a runtime exception. Not sure what's going on here. May be if you can share a sample project which has a repro of this issue I can investigate this further. You should also try to get support from jitsi if they have seen this before.
Here is a documentation of what needs to be done when using react native and litho together : https://fblitho.com/docs/faq
Similar issue which was reported before : https://github.com/facebook/litho/issues/224
@arpitratan thanks for your reply, i made small project that have this erorr https://github.com/Equin/Test
@arpitratan any new related to this bug ?