react-native-reanimated: Execution failed for task ':react-native-reanimated:buildCMakeRelWithDebInfo[armeabi-v7a]

Description

While performing Release Build of my React Native App, I receive the following exception (note, Debug build works):

  • What went wrong: Execution failed for task ‘:react-native-reanimated:buildCMakeRelWithDebInfo[armeabi-v7a]’.

com.android.ide.common.process.ProcessException: ninja: Entering directory `K:\Source\collections-source\Collections\node_modules\react-native-reanimated\android.cxx\RelWithDebInfo\1y5e2947\armeabi-v7a’ [0/2] Re-checking globbed directories… [1/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/8d227a0f38aeddc6df1e837bbfea0aa8/Common/cpp/worklets/Tools/JSLogger.cpp.o [2/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/541c11f770471cf339ab8fba0254f9a2/cpp/worklets/Tools/ReanimatedVersion.cpp.o [3/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/5dd35182adbe3968ab437dcaf80f2671/WorkletRuntime/ReanimatedRuntime.cpp.o ninja: build stopped: .

C++ build system [build] failed while executing: @echo off “C:\Users\Tony\AppData\Local\Android\Sdk\cmake\3.22.1\bin\ninja.exe” ^ -C ^ “K:\Source\collections-source\Collections\node_modules\react-native-reanimated\android\.cxx\RelWithDebInfo\1y5e2947\armeabi-v7a” ^ reanimated ^ worklets from K:\Source\collections-source\Collections\node_modules\react-native-reanimated\android ninja: error: mkdir(src/main/cpp/reanimated/CMakeFiles/reanimated.dir/K_/Source/collections-source/Collections/node_modules/react-native-reanimated/Common): No such file or directory

Steps to reproduce

  1. npm start – --reset-cache
  2. npm run android-coin-release

Snack or a link to a repository

https://github.com/s1tony/Collections2

Reanimated version

3.16.1

React Native version

0.76.1

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Fabric (New Architecture)

Build type

Release app & production bundle

Device

Real device

Device model

Samsung S22

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 10
  • Comments: 33

Most upvoted comments

I resolve my problem moving the project to another folder. The path was too long

@tjzel thanks for mentioning this out, and @bondarenkod appreciate the info! It works perfectly. The only tweak I had to make was updating android/gradle.properties by adding:

android.abbis=arm64-v8a,x86,x86_64  
reactNativeArchitectures=arm64-v8a,x86,x86_64  

and removing armeabi-v7a, as the build was failing specifically for that architecture. Everything else cleared without issues. 🚀

Copy of my comment from the already closed as duplicate issue:

  1. Check for the libraries versions: "react-native-reanimated": "3.16.3" "realm": "^12.14.0", // I have it, it requires some kind old ndk version, so I decided to bump its version

  2. Install cmake 3.31.0 via Android Studio. And only this version. I’ve removed all the rest of cmake versions.

  3. Remove all the ndk except the last version one, install the latest version. // again, it could be related to the realm which I have in use

  4. Enable long path on windows, reboot: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

  5. execute in the project from the root path: git clean -xfd && git submodule foreach --recursive git clean -xfd

  6. in the same terminal window execute: 6.1 $Env:CMAKE_VERSION = '3.31.0' // globalb env var could work as well according to the https://github.com/software-mansion/react-native-reanimated/issues/6661#issuecomment-2517193808 6.2 yarn react-native build-android --mode Release

image

It seems like helped me.

./gradlew clean is not exactly a full clean when dealing with React Native. Sometimes I have to do git clean -Xdf because ./gradlew clean fails to execute.

src/main/cpp/reanimated/CMakeFiles/reanimated.dir/K_/Source/collections-source/Collections/node_modules/react-native-reanimated/Common

This is indeed a very weird path. Unfortunately I’m not familiar with the quirks of building React Native on Windows.

You can try ./gradlew --console verbose --no-build-cache -d assembleDebug to get more compilation logs.

Apparently, the issue occurs because the project is inside a folder named “React,” for example: C:\Development\React\my-app\...

When moving the project to a folder that does not contain the word “React” (e.g., C:\Development\my-app\...), the application compiled and worked normally.

This issue occurs with the React Native Reanimated library.

Even after updating the package to the latest version (3.16.7), the problem persists.

The current solution is to move the project to a folder without the word “React” or to a shorter path (e.g., C:\my-app), as many suggest this also resolves the issue.

Since our CI started to pass I think it’s fixed on the newest release of React Native 0.76.5 and no workarounds are needed.

Could you please confirm @s1tony @2004durgesh @bondarenkod?