react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Build failed on android with "Task : android:buildCMakeDebug[arm64-v8a] FAILED"

Open parveen-bhatia opened this issue 1 year ago • 8 comments

Description

After enabling new architecture using newArchEnabled=true in gradle.properties of android project. Not able to build android app on M1 mac

Steps to reproduce

  • Enable the new architecture in gradle.properties of android project by using newArchEnabled=true
  • Build the android project from Android Studio or use yarn android

React Native Version

0.74.3

Affected Platforms

Runtime - Android

Areas

Other (please specify)

Output of npx react-native info

OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 261.36 MB / 32.00 GB
  Shell:
    version: 5.2.26
    path: /opt/homebrew/bin/bash
Binaries:
  Node:
    version: 20.15.1
    path: ~/.nvm/versions/node/v20.15.1/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v20.15.1/bin/npm
  Watchman:
    version: 2024.07.01.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11709847
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 1.8.0_402
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.3
    wanted: 0.74.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

> Task : android:buildCMakeDebug[arm64-v8a] FAILED
-MD -MT CMakeFiles/appmodules.dir/OnLoad.cpp.o -MF CMakeFiles/appmodules.dir/OnLoad.cpp.o.d -o CMakeFiles/appmodules.dir/OnLoad.cpp.o -c {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp
C/C++: In file included from {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:30:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_newarchdefaults/include/DefaultComponentsRegistry.h:11:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/fabricjni/include/react/fabric/ComponentFactory.h:11:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/componentregistry/ComponentDescriptorFactory.h:12:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/ComponentDescriptor.h:12:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/Props.h:12:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/PropsMacros.h:11:
C/C++: /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_utils/include/react/utils/fnv1a.h:24:37: error: no type named 'identity' in namespace 'std'; did you mean 'folly::Identity'?
C/C++: template <typename CharTransformT = std::identity>
C/C++:                                     ^~~~~
C/C++: /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/folly_runtime/include/folly/Utility.h:339:7: note: 'folly::Identity' declared here
C/C++: using Identity = identity_fn;
C/C++:       ^
C/C++: In file included from {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:30:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_newarchdefaults/include/DefaultComponentsRegistry.h:11:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/fabricjni/include/react/fabric/ComponentFactory.h:11:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/componentregistry/ComponentDescriptorFactory.h:12:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/ComponentDescriptor.h:12:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/Props.h:14:
C/C++: /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/RawProps.h:149:38: error: expected concept name with optional arguments
C/C++:   { T::filterRawProps(rawProps) } -> std::same_as<void>;
C/C++:                                      ^
C/C++: In file included from {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:30:
C/C++: In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_newarchdefaults/include/DefaultComponentsRegistry.h:14:
C/C++: /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/ConcreteComponentDescriptor.h:108:19: error: use of undeclared identifier 'RawPropsFilterable'
C/C++:     if constexpr (RawPropsFilterable<ShadowNodeT>) {
C/C++:                   ^
C/C++: {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:34:10: fatal error: 'rncli.h' file not found
C/C++: #include <rncli.h>
C/C++:          ^~~~~~~~~
C/C++: 4 errors generated.

Execution failed for task ': android:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/{user_name}/repo/android-client/ android/.cxx/Debug/so123uq6/arm64-v8a'
  [0/2] Re-checking globbed directories...
  [1/2] Building CXX object CMakeFiles/appmodules.dir/OnLoad.cpp.o
  FAILED: CMakeFiles/appmodules.dir/OnLoad.cpp.o 
….
…
 -c {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp
  In file included from {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:30:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_newarchdefaults/include/DefaultComponentsRegistry.h:11:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/fabricjni/include/react/fabric/ComponentFactory.h:11:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/componentregistry/ComponentDescriptorFactory.h:12:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/ComponentDescriptor.h:12:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/Props.h:12:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/PropsMacros.h:11:
  /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_utils/include/react/utils/fnv1a.h:24:37: error: no type named 'identity' in namespace 'std'; did you mean 'folly::Identity'?
  template <typename CharTransformT = std::identity>
                                      ^~~~~
  /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/folly_runtime/include/folly/Utility.h:339:7: note: 'folly::Identity' declared here
  using Identity = identity_fn;
        ^
  In file included from {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:30:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_newarchdefaults/include/DefaultComponentsRegistry.h:11:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/fabricjni/include/react/fabric/ComponentFactory.h:11:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/componentregistry/ComponentDescriptorFactory.h:12:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/ComponentDescriptor.h:12:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/Props.h:14:
  /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/RawProps.h:149:38: error: expected concept name with optional arguments
    { T::filterRawProps(rawProps) } -> std::same_as<void>;
                                       ^
  In file included from {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:30:
  In file included from /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_newarchdefaults/include/DefaultComponentsRegistry.h:14:
  /Users/{user_name}/.gradle/caches/transforms-4/e4ff38ca226999e5e3d63c74b8528558/transformed/react-android-0.74.3-debug/prefab/modules/react_nativemodule_core/include/react/renderer/core/ConcreteComponentDescriptor.h:108:19: error: use of undeclared identifier 'RawPropsFilterable'
      if constexpr (RawPropsFilterable<ShadowNodeT>) {
                    ^
  {path}/mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:34:10: fatal error: 'rncli.h' file not found
  #include <rncli.h>
           ^~~~~~~~~
  4 errors generated.
  ninja: build stopped: subcommand failed.

* Try:
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ': android:buildCMakeDebug[arm64-v8a]'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:148)
	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:146)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:134)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)
	at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: org.gradle.internal.UncheckedException: com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/{user_name}/repo/android-client/ android/.cxx/Debug/so123uq6/arm64-v8a'
[0/2] Re-checking globbed directories...

Reproducer

Couldn't share as it's organization private repo

Screenshots and Videos

No response

parveen-bhatia avatar Sep 13 '24 21:09 parveen-bhatia

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

react-native-bot avatar Sep 13 '24 21:09 react-native-bot

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.74.5. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot avatar Sep 13 '24 21:09 react-native-bot

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:

react-native-bot avatar Sep 13 '24 21:09 react-native-bot

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot avatar Sep 13 '24 21:09 react-native-bot

Please share a minimal reproducer

migueldaipre avatar Sep 14 '24 14:09 migueldaipre

Couldn't share as it's organization private repo

As @migueldaipre, we would need a bit of more information. Generally this kind of issues are due to @parveen-bhatia you using a different NDK version as the expected one

cortinico avatar Sep 16 '24 13:09 cortinico

I tried using ndkVersion "26.1.10909125" and now getting only one error as below:

/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:34:10: fatal error: 'rncli.h' file not found
  #include <rncli.h>
           ^~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.
  
  C++ build system [build] failed while executing:
      /Users/{user_name}/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -C \
        /Users/{user_name}/repo/android-client/android/.cxx/Debug/1f6nd2o2/arm64-v8a \
        appmodules
    from /Users/{user_name}/repo/android-client/]android

Please let me know if this is the expected ndkversion ?

parveen-bhatia avatar Sep 17 '24 22:09 parveen-bhatia

I tried using ndkVersion "26.1.10909125" and now getting only one error as below:

For 0.74, it's the one you specified: "26.1.10909125"

/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp:34:10: fatal error: 'rncli.h' file not found

This error happens when the autolinking coming from the CLI is not running.

The rncli.h file should be located at:

android/app/build/generated/rncli/src/main/jni/rncli.h

Without a reproducer I can't help you further as there are a number of reason why this could be failing (wrong package installed, wrong configuration in your .gradle files, etc.)

cortinico avatar Sep 18 '24 09:09 cortinico

@parveen-bhatia Try Refresh Linked C++ projects from Android Studio Screenshot 2024-09-24 at 11 53 01

abumubaarak avatar Sep 24 '24 11:09 abumubaarak

As this issue is partially solved and we haven't heard from you in ~2 weeks, we're now closign it. Feel free to open a new one if you still have problem with #include <rncli.h>

cortinico avatar Sep 26 '24 14:09 cortinico

Just a heads up that updating my OnLoad.cpp and CMakeList.txt to match the RN version samples that do not include rncli.h did the trick for me.

antonis avatar Oct 09 '24 09:10 antonis

Just a heads up that updating my OnLoad.cpp and CMakeList.txt to match the RN version samples that do not include rncli.h did the trick for me.

The above hack introduces this new error instead. #include <autolinking.h> ^~~~~~~~~~~~~~~

jet2018 avatar Oct 16 '24 06:10 jet2018

Just a heads up that updating my OnLoad.cpp and CMakeList.txt to match the RN version samples that do not include rncli.h did the trick for me.

The above hack introduces this new error instead. #include <autolinking.h> ^~~~~~~~~~~~~~~

facing same error

kapilw360 avatar Dec 09 '24 11:12 kapilw360

facing the same error first i was facing jvm error and solved then I see another one which is soloader I solved that in mainApplication.kt and then now the same error like here the other developer face like what should we do image

mustafazeb381-123 avatar Dec 23 '24 13:12 mustafazeb381-123

I had to rm -rf ./node_modules && pnpm cache delete && pnpm install

jamesone avatar May 31 '25 05:05 jamesone

+1

shafqatbari avatar Jun 23 '25 10:06 shafqatbari

+1

riorafe avatar Jun 24 '25 05:06 riorafe

I have faced same issue, after upgrade from 0.72.11 to 0.74.5

anuragdce avatar Jul 09 '25 09:07 anuragdce

+1

Paul12pp avatar Jul 10 '25 23:07 Paul12pp

same issue in "react-native": "0.80.1",

Yeasirarafat53 avatar Jul 23 '25 08:07 Yeasirarafat53