react-native-reanimated: [🐛] react-native-reanimated:buildCMakeDebug[arm64-v8a] FAILED only in Windows

Description

Description This issue is only in windows , mac there is no problem, With yarn android the build Build failed with an exception, i am not able to build the app

the length of the path is within 250 characters.

System: OS: Windows 11 10.0.26100 CPU: (8) x64 11th Gen Intel® Core™ i7-1165G7 @ 2.80GHz Memory: 1.22 GB / 15.78 GB Binaries: Node: version: 20.0.0 path: C:\Program Files\nodejs\node.EXE Yarn: version: 1.22.22 path: C:\Program Files\nodejs\yarn.CMD npm: version: 9.6.4 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels:

  • “34”
  • “35”
  • “35” Build Tools:
  • 29.0.3
  • 33.0.1
  • 34.0.0
  • 35.0.0
  • 36.0.0 System Images:
  • android-35 | Google Play Intel x86_64 Atom Android NDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-242.23339.11.2421.12700392 Visual Studio: Not Found Languages: Java: 17.0.12 Ruby: Not Found npmPackages: “@react-native-community/cli”: installed: 15.1.3 wanted: ^15.1.3 react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.73.11 wanted: ^0.73.0 react-native-windows: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: Not found newArchEnabled: Not found

I am getting the following error:

FAILURE: Build failed with an exception.

Task :react-native-reanimated:configureCMakeDebug[arm64-v8a] C/C++: CMake Warning in src/main/cpp/reanimated/CMakeLists.txt: C/C++: The object file directory C/C++: C:/circle_mobile/circle-mobile-app/examples/SampleApp/node_modules/react-native-reanimated/android/.cxx/Debug/3z1d2p4v/arm64-v8a/src/main/cpp/reanimated/CMakeFiles/reanimated.dir/./ C/C++: has 181 characters. The maximum full path to an object file is 250 C/C++: characters (see CMAKE_OBJECT_PATH_MAX). Object file C/C++: C_/circle_mobile/circle-mobile-app/examples/SampleApp/node_modules/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/ReanimatedWorkletRuntimeDecorator.cpp.o C/C++: cannot be safely placed under this directory. The build may not work C/C++: correctly.

Task :react-native-reanimated:buildCMakeDebug[arm64-v8a] C/C++: ninja: error: mkdir(src/main/cpp/reanimated/CMakeFiles/reanimated.dir/C_/circle_mobile/circle-mobile-app/examples/SampleApp/node_modules/react-native-reanimated): No such file or directory

What went wrong: Execution failed for task ‘:react-native-reanimated:buildCMakeDebug[arm64-v8a]’. com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\circle_mobile\circle-mobile-app\examples\SampleApp\node_modules\react-native-reanimated\android.cxx\Debug\3z1d2p4v\arm64-v8a’ [0/2] Re-checking globbed directories… [1/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/d536b8feb34efab1abcdea8f294526a3/Registries/WorkletRuntimeRegistry.cpp.o [2/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/70f724fbe71ffd138f810d7a60f0a7cf/worklets/Tools/ReanimatedJSIUtils.cpp.o [3/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/bc49fa34ae189dcf36c57bfc2721d736/cpp/worklets/Tools/JSScheduler.cpp.o [4/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/b0b56584fcb3aa7f8f210ba0045a58e4/Common/cpp/worklets/Tools/JSLogger.cpp.o [5/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/bc49fa34ae189dcf36c57bfc2721d736/cpp/worklets/Tools/AsyncQueue.cpp.o [6/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/bc49fa34ae189dcf36c57bfc2721d736/cpp/worklets/Tools/JSISerializer.cpp.o [7/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/70f724fbe71ffd138f810d7a60f0a7cf/worklets/Tools/WorkletEventHandler.cpp.o [8/37] Building CXX object src/main/cpp/reanimated/CMakeFiles/reanimated.dir/8ea88b84efb26eb58b6d8ba349f65392/Fabric/PropsRegistry.cpp.o [9/37] Building CXX object src/main/cpp/worklets/CMakeFiles/worklets.dir/d536b8feb34efab1abcdea8f294526a3/Registries/EventHandlerRegistry.cpp.o [10/37] Building CXX object src/main/cpp/reanimated/CMakeFiles/reanimated.dir/8ea88b84efb26eb58b6d8ba349f65392/Fabric/ReanimatedCommitHook.cpp.o [11/37] Building CXX object src/main/cpp/reanimated/CMakeFiles/reanimated.dir/8ea88b84efb26eb58b6d8ba349f65392/Fabric/ShadowTreeCloner.cpp.o [12/37] Building CXX object src/main/cpp/reanimated/CMakeFiles/reanimated.dir/8ea88b84efb26eb58b6d8ba349f65392/Fabric/ReanimatedMountHook.cpp.o [13/37] Building CXX object src/main/cpp/reanimated/CMakeFiles/reanimated.dir/54d6330cf11627d0dd1501ed01b2d737/LayoutAnimationsProxy.cpp.o [14/37] Building CXX object src/main/cpp/reanimated/CMakeFiles/reanimated.dir/54d6330cf11627d0dd1501ed01b2d737/LayoutAnimationsUtils.cpp.o ninja: build stopped: .

C++ build system [build] failed while executing: @echo off “C:\Users\User\AppData\Local\Android\Sdk\cmake\3.22.1\bin\ninja.exe” ^ -C ^ “C:\circle_mobile\circle-mobile-app\examples\SampleApp\node_modules\react-native-reanimated\android.cxx\Debug\3z1d2p4v\arm64-v8a” ^ reanimated ^ worklets from C:\circle_mobile\circle-mobile-app\examples\SampleApp\node_modules\react-native-reanimated\android ninja: error: mkdir(src/main/cpp/reanimated/CMakeFiles/reanimated.dir/C_/circle_mobile/circle-mobile-app/examples/SampleApp/node_modules/react-native-reanimated): No such file or directory

i have tried many solutions nothing seems to be working can any one give me some solution.

Steps to reproduce

clone the repo follow the steps https://github.com/GetStream/stream-chat-react-native/tree/develop/examples/SampleApp build the project using yarn android this issue is only on windows laptop

Snack or a link to a repository

https://github.com/GetStream/stream-chat-react-native/tree/develop/examples/SampleApp

Reanimated version

3.16.6

React Native version

0.73.0

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 27 (3 by maintainers)

Commits related to this issue

Most upvoted comments

The issue has to do with Ninja not handling the long paths in Windows. This was addressed in release 1.12.1 (ninja bug report). I resolved it by downloading the latest Ninja release and copying it to Android/SDK/cmake/<version>/bin. Ninja can be downloaded from here

reduce you file directory to the least as possible eg : c/project this worked for me

Hey! 👋

The issue doesn’t seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

None of these worked for me

Maybe because I’m using Expo SDK53

The issue has to do with Ninja not handling the long paths in Windows. This was addressed in release 1.12.1 (ninja bug report). I resolved it by downloading the latest Ninja release and copying it to Android/SDK/cmake//bin. Ninja can be downloaded from here

If anyone who has followed the solution step provided and is still encountering errors, on my machine it was also necessary to execute these commands in powershell with administrator permission, to increase the reading of longer paths:

Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem” -Name “LongPathsEnabled” -Value 1

After running this command, simply restart your machine, and the project should be functional!

Hi all, we added “Building for Android on Windows” troubleshooting guide to Reanimated docs. Please consult this page if you face any build errors for Android devices when building your app on Windows.

➡️ https://docs.swmansion.com/react-native-reanimated/docs/guides/building-on-windows

If the problem still persists, feel free to re-open the issue or submit a new one.

I had same issue. I tried few solutions but only working fast solution for me was to reduce project file path or shorter folder naming convention.

reduce you file directory to the least as possible eg : c/project this worked for me

This works for me! Thank you!