rudderlabs / rudder-sdk-react-native

Repository for RudderStack's React Native SDK - to track your event data via RudderStack.
https://www.rudderstack.com
Other
17 stars 18 forks source link

BUG : Duplicate class found #246

Closed bhavesh-mudrex closed 11 months ago

bhavesh-mudrex commented 1 year ago

Describe the bug

Getting duplicate class error in react native

Which platform is the issue occurring on Is the error occurring on:

To Reproduce Steps to reproduce the behaviour:

npm run android

Error ` What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class com.rudderstack.android.sdk.core.Constants found in modules jetified-core-1.18.1-runtime (com.rudderstack.android.sdk:core:1.18.1) and jetified-core-mpx-1.1.1-runtime (com.rudderstack.android.sdk:core-mpx:1.1.1) Duplicate class com.rudderstack.android.sdk.core.DBInsertionHandlerThread found in modules jetified-core-1.18.1-runtime (com.rudderstack.android.sdk:core:1.18.1) and jetified-core-mpx-1.1.1-runtime (com.rudderstack.android.sdk:core-mpx:1.1.1) Duplicate class com.rudderstack.android.sdk.core.DBInsertionHandlerThread$DBInsertionHandler found in modules jetified-core-1.18.1-runtime (com.rudderstack.android.sdk:core:1.18.1) and jetified-core-mpx-1.1.1-runtime (com.rudderstack.android.sdk:core-mpx:1.1.1) Duplicate class com.rudderstack.android.sdk.core.DBPersistentManager found in modules jetified-core-1.18.1-runtime (com.rudderstack.android.sdk:core:1.18.1) and jetified-core-mpx-1.1.1-runtime (com.rudderstack.android.sdk:core-mpx:1.1.1) Duplicate class com.rudderstack.android.sdk.core.EventRepository found in modules jetified-core-1.18.1-runtime (com.rudderstack.android.sdk:core:1.18.1) and jetified-core-mpx-1.1.1-runtime (com.rudderstack.android.sdk:core-mpx:1.1.1) Duplicate class com.rudderstack.android.sdk.core.EventRepository$1 found in modules jetified-core-1.18.1-runtime (com.rudderstack.android.sdk:core:1.18.1) and jetified-core-mpx-1.1.1-runtime (com.rudderstack.android.sdk:core-mpx:1.1.1) `

package.json

"dependencies": {
    "@invertase/react-native-apple-authentication": "^2.1.5",
    "@mudrex/auth": "^1.0.1",
    "@native-html/iframe-plugin": "^2.6.1",
    "@notifee/react-native": "^5.4.1",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/blur": "^4.3.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/netinfo": "^9.0.0",
    "@react-native-community/push-notification-ios": "^1.10.1",
    "@react-native-community/toolbar-android": "^0.2.1",
    "@react-native-firebase/analytics": "^17.0.0",
    "@react-native-firebase/app": "^17.0.0",
    "@react-native-firebase/crashlytics": "^17.0.0",
    "@react-native-firebase/dynamic-links": "^17.0.0",
    "@react-native-firebase/messaging": "^17.0.0",
    "@react-native-firebase/perf": "^17.0.0",
    "@react-native-google-signin/google-signin": "^7.0.4",
    "@react-native-masked-view/masked-view": "^0.2.7",
    "@react-navigation/bottom-tabs": "^6.0.9",
    "@react-navigation/elements": "^1.3.17",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/native-stack": "^6.2.5",
    "@reduxjs/toolkit": "^1.6.2",
    "@rudderstack/rudder-sdk-react-native": "^1.9.0",
    "@segment/analytics-react-native": "^2.3.1",
    "@segment/analytics-react-native-plugin-amplitude-session": "^0.3.1",
    "@segment/sovran-react-native": "^0.2.8",
    "@sumsub/react-native-mobilesdk-module": "^1.23.0",
    "appcenter": "4.4.5",
    "appcenter-analytics": "4.4.5",
    "appcenter-crashes": "4.4.5",
    "axios": "0.18.0",
    "axios-retry": "^3.5.1",
    "clevertap-react-native": "^1.1.1",
    "d3-shape": "^3.1.0",
    "dayjs": "^1.10.7",
    "expo": "^45.0.0",
    "expo-intent-launcher": "~10.2.0",
    "expo-local-authentication": "~12.2.0",
    "frames-react-native": "^1.1.8",
    "hypersnapsdk_reactnative": "4.13.1",
    "i18next": "^21.8.14",
    "i18next-async-storage-backend2": "^2.0.1",
    "i18next-chained-backend": "^3.0.2",
    "i18next-locize-backend": "^5.1.2",
    "intl-pluralrules": "^1.3.1",
    "jwt-decode": "^3.1.2",
    "lottie-react-native": "^5.1.6",
    "mudrex-react-native-design-system": "github:mudrex/mudrex-rn-storybook#master",
    "number-to-locale-string-polyfill": "^1.0.9",
    "query-string": "^8.1.0",
    "react": "18.2.0",
    "react-i18next": "^11.18.1",
    "react-icomoon": "^2.5.4",
    "react-native": "0.66.5",
    "react-native-autolink": "^4.0.0",
    "react-native-bouncy-checkbox": "^2.1.10",
    "react-native-chart-kit": "^6.11.0",
    "react-native-code-push": "^7.0.5",
    "react-native-date-picker": "^4.2.5",
    "react-native-default-preference": "^1.4.4",
    "react-native-device-country": "^1.0.3",
    "react-native-device-info": "^8.7.1",
    "react-native-dotenv": "^3.3.0",
    "react-native-fast-image": "^8.5.11",
    "react-native-file-viewer": "^2.1.5",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "2.9.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-haptic-feedback": "^1.14.0",
    "react-native-image-picker": "^4.8.0",
    "react-native-in-app-review": "^4.3.3",
    "react-native-inappbrowser-reborn": "^3.7.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^2.2.4",
    "react-native-lottie-splash-screen": "^1.1.2",
    "react-native-markdown-display": "^7.0.0-alpha.2",
    "react-native-material-menu": "^2.0.0",
    "react-native-otp-verify": "^1.0.5",
    "react-native-permissions": "^3.2.0",
    "react-native-public-ip": "^1.0.2",
    "react-native-qrcode-svg": "^6.1.2",
    "react-native-raw-bottom-sheet": "^2.2.0",
    "react-native-reanimated": "^3.5.1",
    "react-native-render-html": "^6.3.4",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.9.0",
    "react-native-select-dropdown": "^1.5.0",
    "react-native-share": "^9.2.3",
    "react-native-shared-group-preferences": "git+https://git@github.com/kjellconnelly/react-native-shared-group-preferences.git",
    "react-native-shimmer-placeholder": "^2.0.8",
    "react-native-skeleton-placeholder": "5.0.0",
    "react-native-slider": "^0.11.0",
    "react-native-snackbar": "^2.4.0",
    "react-native-snap-carousel-v4": "^1.0.1",
    "react-native-sound": "^0.11.2",
    "react-native-step-indicator": "^1.0.3",
    "react-native-storage": "^1.0.1",
    "react-native-store-version": "^1.4.0",
    "react-native-svg": "^12.5.1",
    "react-native-svg-charts": "^5.4.0",
    "react-native-svg-transformer": "^0.14.3",
    "react-native-swiper": "^1.6.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-view-shot": "^3.7.0",
    "react-native-walkthrough-tooltip": "^1.5.0",
    "react-native-webview": "11.23.1",
    "react-native-youtube-iframe": "^2.2.2",
    "react-query": "^3.33.7",
    "react-redux": "^7.2.6",
    "react-timer-hook": "^3.0.5",
    "redux": "^4.1.2",
    "redux-persist": "^6.0.0",
    "socket.io-client": "^2.2.0",
    "storyly-react-native": "^1.33.2"
  },
1abhishekpandey commented 1 year ago

Hey @bhavesh-mudrex, Thanks for raising this issue. Can you please make sure, if you've this dependency added in your Android app: com.rudderstack.android.sdk:core-mpx:1.1.0. If yes, then please make sure to remove it.

This could only be possible in case your React Native Android app contains this dependency com.rudderstack.android.sdk:core-mpx:1.1.0. Our "@rudderstack/rudder-sdk-react-native": "^1.9.0" React Native SDK only contains: com.rudderstack.android.sdk:core, refer here, so this issue shouldn't happen ideally from our side.

Additionally, as a troubleshooting step, you can try removing our React Native SDK and check if you still have the com.rudderstack.android.sdk:core-mpx:1.1.0 dependency or not. If yes, then please make sure to remove it.

bhavesh-mudrex commented 1 year ago

project :hypersnapsdk_reactnative is using com.rudderstack.android.sdk:core-mpx:1.1.0 @1abhishekpandey

1abhishekpandey commented 1 year ago

Thanks for the information. We'll investigate and determine if we can take any action to resolve this issue from our side.

bhavesh-mudrex commented 1 year ago

@1abhishekpandey what is the solution for the current implementation, we can't drop hypersnapsdk

bhavesh-mudrex commented 1 year ago

@1abhishekpandey any update?

1abhishekpandey commented 1 year ago

Hey @bhavesh-mudrex, We are currently discussing possible steps internally to address this issue. Once I have all the details, I'll provide you with an update.

Our Android SDK doesn't support multiple instances simultaneously, which is a significant obstacle in resolving this issue. Consequently, we are exploring alternative solutions, if any, to address this.