Repository navigation
React Native issue when newArchEnabled=true in gradle.properties on M1 macs #33521
Description
Activity
I'm having the same problem
I also am having the same problem, I do not know if this is coincidence, but I also am using an Apple Mac M1
Reacted by BenjaminSame 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: arm64info 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 FoundSame problem, I solved it using below method
modify ndk-build file like this
https://stackoverflow.com/questions/69541831/unknown-host-cpu-architecture-arm64-android-ndk-siliconm1-apple-macbook-proReacted by Nicola Corti and Anderson CostaReacted by Anderson CostaSame error here, only in the windows
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....
Any solution?
- 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 - addedType: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)Issues and PRs related to new architecture (Fabric/Turbo Modules)Resolution: PR SubmittedA pull request with a fix has been provided.A pull request with a fix has been provided.and removed
on 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-cpusYou currently have some alternatives:
-
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-buildfile inside the NDK folder. -
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
-
Install the NDK 24 via the SDK manager (in Android studio and do the following):
- Update the
ndkVersioninsideandroid/app/build.gradleto be24.0.8215888 - Set those two environment variables:
- Update the
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.
Reacted by 高昇, Ítalo Menezes, Alejandro Maggi and Minh Nguyễn Linh Đăng-
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.
Could not determine the dependencies of task ':app:mergeDebugAssets'.
BUILD FAILED in 15s
info Run CLI with --verbose flag for more details.
Version
0.68.0-rc.3
Output of
npx react-native infoinfo 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