metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

[Bug]: cannot build a debug version of Metamask for dAPP debugging

Open makinghappen opened this issue 2 years ago • 4 comments

Describe the bug

Cannot build on linux, building accordingly to the instructions in readme for android.

Expected behavior

Build successful

Screenshots/Recordings

No response

Steps to reproduce

build accordingly to the instructions in readme for android

Error messages or log output

when running yarn setup && source .android.env && source .js.env && yarn watch

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installDebug' is ambiguous in project ':app'. Candidates are: 'installFlaskDebug', 'installFlaskDebugAndroidTest', 'installProdDebug', 'installProdDebugAndroidTest', 'installQaDebug', 'installQaDebugAndroidTest'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> 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

BUILD FAILED in 22s

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installDebug' is ambiguous in project ':app'. Candidates are: 'installFlaskDebug', 'installFlaskDebugAndroidTest', 'installProdDebug', 'installProdDebugAndroidTest', 'installQaDebug', 'installQaDebugAndroidTest'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> 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

BUILD FAILED in 22s

    at makeError (/home/user/Documents/metamask-mobile/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
    at /home/user/Documents/metamask-mobile/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (/home/user/Documents/metamask-mobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
    at async Command.handleAction (/home/user/Documents/metamask-mobile/node_modules/@react-native-community/cli/build/index.js:108:9)
info Run CLI with --verbose flag for more details.

see full log attached

if I run cd android/ && ./gradlew app:installProdDebug -PreactNativeDevServerPort=8081 after that, I get

> Task :react-native:ReactAndroid:hermes-engine:buildHermes FAILED

see full log attached

also the same when running source .android.env && source .js.env && yarn start:android

> Task :react-native:ReactAndroid:hermes-engine:buildHermes FAILED

see full log attached

Version

tag 7.14.0

Build type

None

Device

debian 12

Operating system

Android

Additional context

npx react-native info
warn Package rn-fetch-blob contains invalid configuration: "dependency.hooks" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info Fetching system and libraries information...
(node:914190) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
    OS: Linux 6.1 Debian GNU/Linux bookworm/sid
  Binaries:
    Node: 18.18.2 - ~/.local/share/nvm/v18.18.2/bin/node
    Yarn: 1.22.1 - ~/.nvm/versions/node/v16.17.0/bin/yarn
    npm: 9.8.1 - ~/.local/share/nvm/v18.18.2/bin/npm
    Watchman: 4.9.0 - /usr/bin/watchman
  SDKs:
    Android SDK:
      API Levels: 23, 26, 28, 31, 32, 33
      Build Tools: 29.0.2, 30.0.3, 31.0.0, 33.0.0, 33.0.1, 34.0.0
      System Images: android-27 | Google APIs ARM 64 v8a, android-30 | Google Play Intel x86 Atom_64, android-33 | Google APIs Intel x86_64 Atom, android-33 | Google Play ARM 64 v8a, android-33 | Google Play Intel x86_64 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.14 => 0.71.14 
  npmGlobalPackages:
    *react-native*: Not Found

full log for yarn setup && source .android.env && source .js.env && yarn watch metamask-watch-log.txt

full log for cd android/ && ./gradlew app:installProdDebug -PreactNativeDevServerPort=8081 metamas-gradlew-log.txt

full log for source .android.env && source .js.env && yarn start:android metamask-build-log.txt

Severity

cannot build a debug version of Metamask for dAPP debugging

makinghappen avatar Jan 26 '24 23:01 makinghappen

builds only after adding: #include <cstdint> to node_modules/react-native/sdks/hermes/include/hermes/Support/SHA1.h

makinghappen avatar Jan 27 '24 10:01 makinghappen

Hey @makinghappen! Thank you for raising this issue with us! So after you add #include <cstdint> to node_modules/react-native/sdks/hermes/include/hermes/Support/SHA1.h , the build is successful?

ZbrancaI avatar Feb 01 '24 12:02 ZbrancaI

Hi @seaona , @chrisleewilcox mentioned you have Linux. Out of curiosity are you able to build a debug build on your machine?

gauthierpetetin avatar Mar 15 '24 17:03 gauthierpetetin

@ZbrancaI yes, after adding this include, it builds successfully

makinghappen avatar May 20 '24 14:05 makinghappen

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

github-actions[bot] avatar Aug 18 '24 15:08 github-actions[bot]

This issue was closed because there has been no follow activity in 7 days. If you feel this was closed in error please provide evidence on the current production app in a new issue or comment in the existing issue to a maintainer. Thank you for your contributions.

github-actions[bot] avatar Aug 25 '24 16:08 github-actions[bot]

Since there's a solution to unblock the build, we will close this issue for now.

Cal-L avatar Aug 29 '24 15:08 Cal-L