React Native SDK Quick Start doesn't work

I cloned the repository and try to set it up and run. But I am getting this error.
How to resolve it? I can’t run it on my android device.

FAILURE: Build completed with 2 failures.

1: Task 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/libcrypto.so’ from inputs:
- /home/tahmid/Projects/reactnative_mobile_app/newonw/w3a-rn-bare-demo/w3a-rn-bare-demo/web3auth-pnp-examples/react-native/rn-bare-quick-start/node_modules/react-native-quick-crypto/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libcrypto.so
- /home/tahmid/.gradle/caches/transforms-3/61058fb40c4670eaad4c5b69643fae17/transformed/jetified-flipper-0.182.0/jni/arm64-v8a/libcrypto.so
If you are using jniLibs and CMake IMPORTED targets, see
Android Gradle plugin 8.2 release notes  |  Android Studio  |  Android Developers

  • 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.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    java.lang.StackOverflowError (no error message)

  • 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.
==============================================================================

BUILD FAILED in 44s

error Failed to install the app.
info Run CLI with --verbose flag for more details.

@muhammad.tahmid.isla Thanks for reporting.

Your feedback has been forwarded to our team and we will get back to you with further updates.

@muhammad.tahmid.isla Our team are reviewing your issue and will get back. Please avoid creating duplicate threads for the same issue.

The new post was regarding a new issue. It asked me to install crypto and when I installed crypto, it still didn’t work. I am still looking forward to having a response from the team which I haven’t yet. It’s been 10 days. How long does it generally take to get help?

Hey @muhammad.tahmid.isla,

I see you’re encountering an issue with resolving the crypto package. To address this, I recommend checking out the metro.config.js configuration suggested in our documentation, which you can find here. Additionally, ensure you’ve installed the necessary polyfilled packages as outlined in the guide.

I also want to mention that if there was an issue with our quickstart example for Android, it would have affected our demo preview as well. Since the demo at this link is functioning correctly, it suggests that the quickstart example should be operational. Please take a moment to review the demo to ensure your setup aligns with the provided example.

If you have followed these steps and continue to experience difficulties, please don’t hesitate to let me know. I’m here to assist you with any further issues you might encounter.

Hello @maharshi @vjgee

Thanks for your response. I have tried everything you said and the previous issues are resolved. However, there is a new error and I think the empty module is not working for this error.

For Your Informatio, I couldn’t make degit work so I cloned the whole repository. and experienced the following case -

The error I got this is as follows -

FAILURE: Build completed with 2 failures.

1: Task 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/libcrypto.so' from inputs:
      - /home/tahmid/Projects/reactnative_mobile_app/thirdproject/web3auth-pnp-examples/react-native/rn-bare-quick-start/node_modules/react-native-quick-crypto/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libcrypto.so
      - /home/tahmid/.gradle/caches/transforms-3/61058fb40c4670eaad4c5b69643fae17/transformed/jetified-flipper-0.182.0/jni/arm64-v8a/libcrypto.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

After receiving this error, I created a new project and pasted the copied content from the example.
But, the build failed again with another error -

error: Error: Unable to resolve module missing-asset-registry-path from /home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/react-native/Libraries/LogBox/UI/LogBoxImages/chevron-left.png: missing-asset-registry-path could not be found within the project or in these directories:
  node_modules/react-native/node_modules
  node_modules
> 1 | �PNG
  2 | �
  3 | 
  4 | IHD�8��EIDATx�c�	�'.�p�?
                               ���1i���@:�t�@���ѥ	+ l�#G�L��=��C0������+IEND�B`�
    at ModuleResolver.resolveDependency (/home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:153:15)
    at DependencyGraph.resolveDependency (/home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/metro/src/node-haste/DependencyGraph.js:271:43)
    at /home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/metro/src/lib/transformHelpers.js:176:21
    at resolveDependencies (/home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/metro/src/DeltaBundler/buildSubgraph.js:56:25)
    at visit (/home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/metro/src/DeltaBundler/buildSubgraph.js:107:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 11)
    at async visit (/home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
    at async Promise.all (index 10)
    at async visit (/home/tahmid/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)

hevron-left.png is located at home/user/Projects/reactnative_mobile_app/reactCLI/MyWeb3AuthApp/node_modules/react-native/Libraries/LogBox/UI/LogBoxImages

Global.js -
global.Buffer = require(“buffer”).Buffer;

// Needed so that ‘stream-http’ chooses the right default protocol.

global.location = {
  protocol: "file:",
};

global.process.version = "v16.0.0";
if (!global.process.version) {
  global.process = require("process");
  console.log({ process: global.process });
}

process.browser = true;

metro.config.js →

const { getDefaultConfig } = require("metro-config");

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts },
  } = await getDefaultConfig(__dirname);

  const defaultSourceExts = [...sourceExts, "svg", "mjs", "cjs"];

  return {
    resolver: {
      extraNodeModules: {
        assert: require.resolve("empty-module"), // assert can be polyfilled here if needed
        http: require.resolve("empty-module"), // stream-http can be polyfilled here if needed
        https: require.resolve("empty-module"), // https-browserify can be polyfilled here if needed
        os: require.resolve("empty-module"), // os-browserify can be polyfilled here if needed
        url: require.resolve("empty-module"), // url can be polyfilled here if needed
        zlib: require.resolve("empty-module"), // browserify-zlib can be polyfilled here if needed
        path: require.resolve("empty-module"),
        crypto: require.resolve("crypto-browserify"),
        stream: require.resolve("readable-stream"),
      },

      assetExts: assetExts.filter((ext) => ext !== "svg"),

      sourceExts: process.env.TEST_REACT_NATIVE ? ["e2e.js"].concat(defaultSourceExts) : defaultSourceExts,
    },
    transformer: {
      getTransformOptions: async () => ({
        transform: {
          experimentalImportSupport: false,
          inlineRequires: true,
        },
      }),
    },
  };
})();

package.json →

  "name": "MyWeb3AuthApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@ethersproject/shims": "^5.7.0",
    "@toruslabs/react-native-web-browser": "^1.1.0",
    "@web3auth/base": "^7.3.2",
    "@web3auth/ethereum-provider": "^7.3.2",
    "@web3auth/react-native-sdk": "^5.1.0",
    "buffer": "^6.0.3",
    "crypto-browserify": "^3.12.0",
    "empty-module": "^0.0.2",
    "ethers": "^6.11.0",
    "process": "^0.11.10",
    "react": "18.2.0",
    "react-native": "0.73.4",
    "react-native-crypto": "^2.2.0",
    "react-native-encrypted-storage": "^4.0.3",
    "react-native-get-random-values": "^1.10.0",
    "react-native-randombytes": "^3.6.1",
    "readable-stream": "^4.5.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "0.73.21",
    "@react-native/eslint-config": "0.73.2",
    "@react-native/metro-config": "0.73.5",
    "@react-native/typescript-config": "0.73.1",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}```
These are the file in my project folder -
![image|690x206](upload://3N6o3ukv8SFIRiS7ve7rCvOMwKA.png)


Looking forward to your quick assistance. Thank you.
1 Like