Rapsssito / react-native-tcp-socket

React Native TCP socket API for Android, iOS & macOS with SSL/TLS support.
MIT License
315 stars 80 forks source link

Execution failed for task ':app:checkReleaseDuplicateClasses' for android #199

Open vr7bd opened 1 month ago

vr7bd commented 1 month ago

Description

After upgrading to 6.2.0, I'm unable to build my project with this error

Execution failed for task ':app:checkReleaseDuplicateClasses'.

> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable

   > Duplicate class org.bouncycastle.LICENSE found in modules bcprov-jdk15on-1.70.jar -> jetified-bcprov-jdk15on-1.70 (org.bouncycastle:bcprov-jdk15on:1.70) and bcprov-jdk15to18-1.70.jar -> jetified-bcprov-jdk15to18-1.70 (org.bouncycastle:bcprov-jdk15to18:1.70)

I traced it and found out that this occurs if expo-updates is installed and react-native-tcp-socket is on version 6.2.0. It's because of the commit 054c789 where these dependencies are added

    // Bouncy Castle dependencies
    implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
    implementation 'org.bouncycastle:bcpkix-jdk15on:1.70'

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a new expo project and install expo updates
  2. Install the latest version of react-native-tcp-socket
  3. npx expo prebuild && npx expo run:android
regulad commented 2 weeks ago

Go into your ./android/app/build.gradle and add this in the dependencies block. It will ignore the bad version of bouncycastle.

    implementation(project(':react-native-tcp-socket')) {
        exclude group: 'org.bouncycastle'
    }
siarheipashkevich commented 4 days ago

The same issue!

@regulad how to do your solution for Expo EAS builds?

siarheipashkevich commented 4 days ago

@vr7bd did you solve this issue?

vr7bd commented 2 hours ago

@vr7bd did you solve this issue?

Not exactly. This works but as pointed out, for EAS builds, this is not a good solution. So I just downgraded to 6.0.1 (if I remember correctly), which is the version prior to the commit of the dependency