margelo / react-native-quick-crypto

⚡️ A fast implementation of Node's `crypto` module written in C/C++ JSI
Other
713 stars 91 forks source link

🔧 libreactnative.so duplicate error #506

Open michaelessiet opened 1 day ago

michaelessiet commented 1 day ago

How were you trying to build the app?

I was trying to build the app locally. npx expo run:android . This issue has been solved in vision camera already btw https://github.com/mrousavy/react-native-vision-camera/pull/3281. So should be a quick fix

Full build logs

> Task :app:mergeDebugNativeLibs FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libreactnative.so' from inputs:
      - /Users/michaelessiet/Developer/Tidus/Tidus-Wallet/node_modules/react-native-quick-crypto/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/arm64-v8a/libreactnative.so
      - /Users/michaelessiet/.gradle/caches/8.10.2/transforms/4aa1a5221112ac53de7611a04ff14f78/transformed/react-android-0.76.1-debug/jni/arm64-v8a/libreactnative.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 12m 46s
1183 actionable tasks: 1183 executed
Error: /Users/michaelessiet/Developer/Tidus/Tidus-Wallet/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a exited with non-zero code: 1
Error: /Users/michaelessiet/Developer/Tidus/Tidus-Wallet/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/michaelessiet/.npm/_npx/465204617ec45935/node_modules/@expo/spawn-async/src/spawnAsync.ts:67:13)
    at Object.onceWrapper (node:events:634:26)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)
    ...
    at spawnAsync (/Users/michaelessiet/.npm/_npx/465204617ec45935/node_modules/@expo/spawn-async/src/spawnAsync.ts:28:21)
    at spawnGradleAsync (/Users/michaelessiet/.npm/_npx/465204617ec45935/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:134:28)
    at assembleAsync (/Users/michaelessiet/.npm/_npx/465204617ec45935/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:83:16)
    at runAndroidAsync (/Users/michaelessiet/.npm/_npx/465204617ec45935/node_modules/@expo/cli/src/run/android/runAndroidAsync.ts:48:24)

Project dependencies

"dependencies": {
    "@babel/plugin-proposal-numeric-separator": "^7.18.6",
    "@clustersxyz/sdk": "^0.1.6",
    "@craftzdog/react-native-buffer": "^6.0.5",
    "@d11/react-native-fast-image": "^8.8.0",
    "@ethersproject/shims": "^5.7.0",
    "@expo-google-fonts/poppins": "^0.2.3",
    "@expo-google-fonts/roboto-condensed": "^0.2.3",
    "@expo/vector-icons": "^14.0.2",
    "@gorhom/bottom-sheet": "^4.6.4",
    "@json-rpc-tools/utils": "^1.7.6",
    "@marinade.finance/marinade-ts-sdk": "^5.0.10",
    "@mayanfinance/swap-sdk": "^9.6.0",
    "@orbs-network/ton-access": "^2.3.3",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/netinfo": "^11.4.1",
    "@react-native-masked-view/masked-view": "0.3.1",
    "@react-native-material/core": "^1.3.7",
    "@react-native-menu/menu": "^1.1.6",
    "@react-navigation/native": "^6.1.2",
    "@react-navigation/native-stack": "^6.9.8",
    "@reduxjs/toolkit": "^1.9.1",
    "@reown/walletkit": "^1.1.1",
    "@sentry/react-native": "~6.1.0",
    "@shopify/flash-list": "1.7.1",
    "@shopify/react-native-skia": "1.5.0",
    "@solana/spl-token": "^0.3.11",
    "@solana/spl-token-registry": "^0.2.4574",
    "@solana/web3.js": "^1.91.1",
    "@sushiswap/sdk": "^5.0.0-canary.116",
    "@tamagui/colors": "^1.111.10",
    "@tamagui/config": "^1.111.10",
    "@tamagui/lucide-icons": "^1.111.10",
    "@tanstack/query-async-storage-persister": "^5.45.0",
    "@tanstack/react-query": "^5.40.0",
    "@tanstack/react-query-persist-client": "^5.45.1",
    "@ton/core": "^0.56.3",
    "@ton/crypto": "^3.2.0",
    "@ton/ton": "^13.11.2",
    "@uniswap/sdk": "^3.0.3",
    "@walletconnect/react-native-compat": "^2.17.2",
    "@walletconnect/utils": "^2.17.2",
    "alchemy-sdk": "^3.1.2",
    "assert": "^1.5.0",
    "axios": "^1.3.3",
    "babel-plugin-module-resolver": "^5.0.0",
    "big-integer": "^1.6.51",
    "big-number": "^2.0.0",
    "bignumber.js": "^9.1.1",
    "bip39": "^3.0.4",
    "bitcoin-address-validation": "^2.2.1",
    "bitcoinjs-lib": "^6.1.0",
    "bitcore-lib": "^10.0.36",
    "buffer": "^6.0.3",
    "decimal.js": "^10.4.3",
    "devshogun-minimize-app": "0.5.5",
    "ed25519-hd-key": "^1.3.0",
    "ethers": "^5.7.2",
    "expo": "^52.0.0",
    "expo-application": "~6.0.1",
    "expo-auth-session": "~6.0.0",
    "expo-build-properties": "~0.13.1",
    "expo-camera": "~16.0.3",
    "expo-constants": "~17.0.2",
    "expo-crypto": "~14.0.1",
    "expo-device": "~7.0.1",
    "expo-font": "~13.0.1",
    "expo-image-picker": "~16.0.1",
    "expo-linear-gradient": "~14.0.1",
    "expo-linking": "~7.0.2",
    "expo-local-authentication": "~15.0.1",
    "expo-notifications": "~0.29.6",
    "expo-random": "~14.0.1",
    "expo-secure-store": "~14.0.0",
    "expo-splash-screen": "~0.29.5",
    "expo-status-bar": "~2.0.0",
    "expo-system-ui": "~4.0.2",
    "expo-updates": "~0.26.5",
    "expo-web-browser": "~14.0.0",
    "fast-text-encoding": "^1.0.6",
    "intl": "^1.2.5",
    "native-base": "^2.15.2",
    "number-formatter": "^1.2.0",
    "path-browserify": "^0.0.0",
    "process": "^0.11.10",
    "quickswap-sdk-lite": "^1.0.5",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-native": "0.76.1",
    "react-native-biometrics": "^3.0.1",
    "react-native-cloud-storage": "^2.2.1",
    "react-native-dotenv": "^3.4.8",
    "react-native-element-dropdown": "^2.6.0",
    "react-native-error-boundary": "^1.2.1",
    "react-native-flash-message": "^0.4.0",
    "react-native-gesture-handler": "~2.20.2",
    "react-native-get-random-values": "~1.11.0",
    "react-native-graph": "^0.3.0",
    "react-native-haptic-feedback": "^1.14.0",
    "react-native-level-fs": "^3.0.1",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-loading-spinner-overlay": "^3.0.1",
    "react-native-mmkv-storage": "^0.11.2",
    "react-native-pager-view": "6.4.1",
    "react-native-popover-view": "^5.1.8",
    "react-native-qrcode-svg": "6.3.0",
    "react-native-quick-base64": "^2.0.8",
    "react-native-quick-crypto": "^0.7.6",
    "react-native-reanimated": "~3.16.1",
    "react-native-reanimated-carousel": "^3.3.0",
    "react-native-safe-area-context": "4.12.0",
    "react-native-screens": "4.0.0",
    "react-native-skeleton-placeholder": "github:michaelessiet/react-native-skeleton-placeholder",
    "react-native-slide-modal": "^0.0.32",
    "react-native-super-grid": "^6.0.1",
    "react-native-svg": "15.8.0",
    "react-native-toast-message": "^2.1.6",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-view-more-text": "^2.2.0",
    "react-native-wagmi-charts": "^2.2.0",
    "react-native-web": "~0.19.13",
    "react-native-webview": "13.12.2",
    "react-number-format": "^5.1.3",
    "react-redux": "^8.0.5",
    "redux-persist": "^6.0.0",
    "redux-persist-transform-encrypt": "^5.0.0",
    "rn-slide-button": "^1.0.3",
    "simple-sushiswap-sdk-v2": "^1.0.0",
    "simple-uniswap-sdk": "^3.7.0",
    "stream-browserify": "^3.0.0",
    "tamagui": "^1.111.10",
    "text-decoding": "^1.0.0",
    "tweetnacl": "^1.0.3",
    "url": "^0.10.3",
    "util": "^0.12.5"
  },
  "devDependencies": {
    "@babel/core": "^7.24.0",
    "@types/bitcore-lib": "^0.15.6",
    "@types/react": "~18.3.12",
    "@types/redux-persist": "^4.3.1",
    "@typescript-eslint/eslint-plugin": "^6.21.0",
    "@typescript-eslint/parser": "^6.21.0",
    "@walletconnect/jsonrpc-types": "^1.0.4",
    "auto-changelog": "^2.4.0",
    "bip32": "^2.0.6",
    "eslint": "^8.34.0",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-native": "^4.0.0",
    "patch-package": "^6.5.1",
    "typescript": "^5.3.0"
  },

QuickCrypto Version

0.7.6

Target platforms

Android

Operating system

MacOS

Can you build the QuickCrypto Example app?

Yes, I can successfully build the Example app here

Additional information

michaelessiet commented 1 day ago

Pasted the last few lines of the build logs because the issue was too long for github to post

C0C41N commented 16 hours ago

@margelo I've created a fix for this and created a PR here

@michaelessiet For stop-gap fix you can add following line in the build.gradle of react-native-quick-crypto:

"**/libreactnative.so"

like following:

packagingOptions {
    doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
    excludes = [
            "**/libc++_shared.so",
            "**/libfbjni.so",
            "**/libreactnativejni.so",
            "**/libjsi.so",
            "**/libreact_nativemodule_core.so",
            "**/libturbomodulejsijni.so",
            "**/MANIFEST.MF",
            "**/libreactnative.so"
    ]
  }