th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.17k stars 200 forks source link

Filename longer than 260 characters Error on React Native Fabric #424

Open alexhernandez opened 1 year ago

alexhernandez commented 1 year ago

Hi 👋, I've been getting the following error on android only when building a react native app with Hermes and Fabric enabled. Not sure if this a known issue or if anyone knows a solution for this.

My Issue:

ninja: error: Stat(safeareacontext_autolinked_build/CMakeFiles/react_codegen_safeareacontext.dir/E_/Workspace/Build.Android.qaRelease/node_modules/react-native-safe-area-context/android/build/generated/source/codegen/jni/react/renderer/components/safeareacontext/safeareacontextJSI-generated.cpp.o): Filename longer than 260 characters

My System info:

info Fetching system and libraries information...
System:
  OS: macOS 13.5.1
  CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Memory: 23.95 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.1
    path: ~/.nvm/versions/node/v18.16.1/bin/node
  Yarn:
    version: 1.18.0
    path: ~/.yarn/bin/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.1/bin/npm
  Watchman:
    version: 2023.08.07.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/alehernandez/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10406996
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.20
    path: /usr/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/alehernandez/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
sebasg0 commented 1 year ago

I have same issue

sebasg0 commented 1 year ago

trying to find a fix, I will notify u if I find one and please also lmk if u are able to fix it

sebasg0 commented 1 year ago

Just reduce the path, I placed the directory in the root and it worked. Then after that you will face another issue with a missing file, for that you will have to use ndkVersion = "25.2.9519653"

alexhernandez commented 1 year ago

I placed the directory in the root and it worked.

Which directory? Do you have a code example?

Piyush-K108 commented 11 months ago

have you got the answer i am still stuck same error

shikharthakur2404 commented 9 months ago

us bro us. im trying with changing versions

whysetiawan commented 5 months ago

Unfortunately it's windows issue. Workaround

AliRezaBeigy commented 1 week ago

Try these steps:

  1. Download the Latest Version of Ninja:

    • Download the latest Ninja release from here.
    • Replace the existing ninja.exe in $SDK_PATH$\cmake\$CMAKE_VERSION$\bin with the newly downloaded version.
  2. Update the build.gradle File:

    • Open android/app/build.gradle.
    • Inside the android.defaultConfig block, add the following code:
    externalNativeBuild {
       cmake {
           arguments "-DCMAKE_MAKE_PROGRAM=$YOUR_CMAKE_NINJA_PATH$", "-DCMAKE_OBJECT_PATH_MAX=1024"
       }
    }

    Make sure to update $YOUR_CMAKE_NINJA_PATH$ with the correct path to your ninja.exe file. For example, it might look something like E:\\SDK\\cmake\\3.22.2\\bin\\ninja.exe on Windows.

  3. Enable Long Path Support in Windows:

    • Run the following PowerShell command to enable long path support in Windows:
    New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

    This will allow Windows to support file paths longer than 260 characters.

Following these steps should help you bypass the path length limitation and resolve the issue.