Skip to content

React Native issue when newArchEnabled=true in gradle.properties on M1 macs #33521

Description

@adil2166

Description

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:mergeDebugAssets'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.facebook.react:react-native:+.
Required by:
project :app
project :app > project :react-native-fbsdk
project :app > project :react-native-onesignal
project :app > project :react-native-webview
project :app > project :react-native-splash-screen
project :app > project :invertase_react-native-apple-authentication
project :app > project :react-native-async-storage_async-storage
project :app > project :react-native-community_masked-view
project :app > project :react-native-community_netinfo
project :app > project :react-native-google-signin_google-signin
project :app > project :react-native-device-info
project :app > project :react-native-fast-image
project :app > project :react-native-mail
project :app > project :react-native-rate
project :app > project :react-native-restart
project :app > project :react-native-svg
project :app > project :react-native-vector-icons
project :app > project :react-native-video
> No matching configuration of project :ReactAndroid was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' but:
- None of the consumable configurations have attributes.
Could not resolve project :ReactAndroid.
Required by:
project :app > project :react-native-gesture-handler
project :app > project :react-native-safe-area-context
project :app > project :react-native-screens
> No matching configuration of project :ReactAndroid was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' but:
- None of the consumable configurations have attributes.

  • 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 15s

at makeError (/Volumes/development/workingdir/react-woocommerce/testingNewArch/WooComApp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Volumes/development/workingdir/react-woocommerce/testingNewArch/WooComApp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Volumes/development/workingdir/react-woocommerce/testingNewArch/WooComApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Volumes/development/workingdir/react-woocommerce/testingNewArch/WooComApp/node_modules/@react-native-community/cli/build/index.js:192:9)

info Run CLI with --verbose flag for more details.

Version

0.68.0-rc.3

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: macOS 12.2.1
CPU: (8) arm64 Apple M1
Memory: 101.91 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.2 - /usr/local/bin/node
Yarn: 1.22.10 - /opt/homebrew/bin/yarn
npm: 8.4.1 - /opt/homebrew/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.2 - /Users/adilkhan/.gem/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7678000
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.12 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.0-rc.3 => 0.68.0-rc.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

npx react-native run-android

Snack, code example, screenshot, or link to a repository

No response

Activity

  1. andresribeiro commented on Mar 31, 2022

    @andresribeiro

    I'm having the same problem

  2. lucasraziel commented on Apr 1, 2022

    @lucasraziel

    I also am having the same problem, I do not know if this is coincidence, but I also am using an Apple Mac M1

  3. ltcaosj commented on Apr 2, 2022

    @ltcaosj

    Same to me - on Apple Mac M1

    [CXX1405] error when building with ndkBuild using /Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Build command failed.
    Error while executing process /Users/xxx/Library/Android/sdk/ndk/21.4.7075529/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/longcao/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/Users/longcao/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/1n6n192e/obj NDK_LIBS_OUT=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/1n6n192e/lib NDK_APPLICATION_MK=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/jni/Application.mk THIRD_PARTY_NDK_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/third-party-ndk REACT_COMMON_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/../ReactCommon REACT_GENERATED_SRC_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/generated/source REACT_SRC_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react -j10 --output-sync=none APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
    ERROR: Unknown host CPU architecture: arm64

    info Fetching system and libraries information...
    System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.39 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
    Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.18 - ~/.yarn/bin/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
    Watchman: Not Found
    Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
    SDKs:
    iOS SDK:
    Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
    IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8193401
    Xcode: 13.3/13E113 - /usr/bin/xcodebuild
    Languages:
    Java: Not Found
    npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.68.0 => 0.68.0
    react-native-macos: Not Found
    npmGlobalPackages:
    react-native: Not Found

  4. dppo commented on Apr 2, 2022

    @dppo
  5. RalissonMattias commented on Apr 4, 2022

    @RalissonMattias

    Same error here, only in the windows

  6. brunoducattii commented on Apr 4, 2022

    @brunoducattii

    Same to me - on Apple Mac M1

    [CXX1405] error when building with ndkBuild using /Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Build command failed. Error while executing process /Users/xxx/Library/Android/sdk/ndk/21.4.7075529/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/longcao/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/Users/longcao/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/1n6n192e/obj NDK_LIBS_OUT=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/1n6n192e/lib NDK_APPLICATION_MK=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/jni/Application.mk THIRD_PARTY_NDK_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/third-party-ndk REACT_COMMON_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/../ReactCommon REACT_GENERATED_SRC_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/build/generated/source REACT_SRC_DIR=/Users/xxx/Documents/RN68/TestRNM1/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react -j10 --output-sync=none APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n} ERROR: Unknown host CPU architecture: arm64

    info Fetching system and libraries information... System: OS: macOS 12.3.1 CPU: (10) arm64 Apple M1 Pro Memory: 1.39 GB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node Yarn: 1.22.18 - ~/.yarn/bin/yarn npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 13.3/13E113 - /usr/bin/xcodebuild Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.0 => 0.68.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

    ...We are facing the same problem here....

  7. euthribeiro commented on Apr 5, 2022

    @euthribeiro

    Any solution?

  8. changed the title [-]react native issue when newArchEnabled= true in gradle.properties[/-] [+]React Native issue when newArchEnabled=true in gradle.properties on M1 macs[/+] on Apr 7, 2022
  9. cortinico commented on Apr 7, 2022

    @cortinico
    Contributor

    This is a known issue with Android NDK and M1 macs. We described it here:
    https://reactnative.dev/docs/next/new-architecture-troubleshooting#android-ndk-and-mac-with-m1-apple-silicon-cpus

    You currently have some alternatives:

    1. Follow the workaround we suggest on the website, the one linked here: [FR] macOS & Apple Silicon Support android/ndk#1299. You'll have to patch a ndk-build file inside the NDK folder.

    2. Wait for 0.68.1 which will contain this fix. With that no workaround will be needed at all: Improve support for Android users on M1 machine #33588

    3. Install the NDK 24 via the SDK manager (in Android studio and do the following):

      1. Update the ndkVersion inside android/app/build.gradle to be 24.0.8215888
      2. Set those two environment variables:
    export LOCAL_ANDROID_NDK_VERSION=24.0.8215888
    export ANDROID_NDK=/opt/android_sdk/ndk/24.0.8215888 # Replace opt/android_sdk with the path to your Android SDK setup.
    

    Hope this clarifies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: PR SubmittedA pull request with a fix has been provided.Type: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions