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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
cortinicocommented, Apr 7, 2022

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: https://github.com/android/ndk/issues/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: https://github.com/facebook/react-native/pull/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.

3reactions
dppocommented, Apr 2, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Publishing to Google Play Store - React Native
Publishing to Google Play Store. Android requires that all apps be digitally signed with a certificate before they can be installed.
Read more >
Could not find tools.jar React native Android in Mac OSX
This error pops up, when some plugins of react-native like masked-view unable to locate tools.jar path in your machine which exists inside ...
Read more >
Gradle sync fails due to inability to start daemon. - Issue Tracker
See notification to sync gradle ... Studio Build: 2020.3.1 Patch 2 (M1 Mac ARM) ... I am still able to run the Android...
Read more >
React native build release error: uncompiled PNG file passed ...
Must be compiled first into .flat file.. error: failed parsing overlays. DO NOT use android.enableAapt2=false in android/gradle.properties for temporary…
Read more >
React Native Android Build with new architecture enabled ...
Where as if i disable the newArchitecure (flag in android/gradle.properties) the build completes around 20 mins. My question was is this issue ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found