Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Duplicate class error when including both React Native and Spectrum #186

Open
vyphan opened this issue Aug 13, 2019 · 5 comments
Open

Duplicate class error when including both React Native and Spectrum #186

vyphan opened this issue Aug 13, 2019 · 5 comments

Comments

@vyphan
Copy link

vyphan commented Aug 13, 2019

React Native version: 0.59.8
Spectrum version: 1.1.0

Tried the following, but it didn't help:

    implementation('com.facebook.spectrum:spectrum-default:1.1.0') {
        exclude group: 'com.facebook.spectrum', module: 'fbjni'
    }

1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.facebook.jni.CppException found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.CppSystemErrorException found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.DestructorThread found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.DestructorThread$1 found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.DestructorThread$Destructor found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.DestructorThread$DestructorList found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.DestructorThread$DestructorStack found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.DestructorThread$Terminus found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.HybridClassBase found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.HybridData found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.HybridData$Destructor found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.IteratorHelper found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.MapIteratorHelper found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.NativeRunnable found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.ThreadScopeSupport found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)
Duplicate class com.facebook.jni.UnknownCppException found in modules classes.jar (com.facebook.react:react-native:0.59.8) and classes.jar (com.facebook.spectrum:spectrum-fbjni:1.1.0)

@cuva
Copy link
Contributor

cuva commented Sep 13, 2019

Hey @vyphan

Thanks for reporting this issue. We've looking into this. I don't have a timeframe to share just yet but will update you as things move forward.

@cuva
Copy link
Contributor

cuva commented Feb 2, 2020

fbjni has been open sourced here. It would likely make sense to make both spectrum and react native use this version to avoid conflicts.

@cxl086
Copy link

cxl086 commented Mar 23, 2020

@vyphan you can exclude spectrum-fbjni module

    implementation("com.facebook.spectrum:spectrum-default:$spectrum") {
        exclude group: 'com.facebook.spectrum', module: 'spectrum-fbjni'
    }

then include independent fbjni library, follow set_up

@chevonc
Copy link

chevonc commented Mar 27, 2020

I've tried the above without success. At runtime, I hit the following SoLoaderError after following instructions above to exclude: Java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/jni/FbJniSoLoader$SoLoaderWrapper; at com.facebook.spectrum.SpectrumSoLoader.init(SpectrumSoLoader.java:52)

@cxl086
Copy link

cxl086 commented Jun 10, 2020

I've tried the above without success. At runtime, I hit the following SoLoaderError after following instructions above to exclude: Java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/jni/FbJniSoLoader$SoLoaderWrapper; at com.facebook.spectrum.SpectrumSoLoader.init(SpectrumSoLoader.java:52)

I copied the source to project. FbJniSoLoader

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants