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.18k stars 201 forks source link

react/renderer/components/view/ViewEventEmitter.h file not found on Android [safe area V4.13.1] #542

Closed nazacity closed 3 weeks ago

nazacity commented 1 month ago

I was trying to upgrade to rn0.76.1 and got below error I tried to remove node_modules folder and reinstall run gradlew clean it's still not working

/node_modules/react-native-safe-area-context/android/src/main/jni/../../../build/generated/source/codegen/jni/react/renderer/components/safeareacontext/EventEmitters.h:12:10: fatal error: 'react/renderer/components/view/ViewEventEmitter.h' file not found
  #include <react/renderer/components/view/ViewEventEmitter.h>

  1 error generated.
  [4/55] Building CXX object rnclipboard_autolinked_build/CMakeFiles/react_codegen_rnclipboard.dir/react/renderer/components/rnclipboard/States.cpp.o
  [5/55] Building CXX object rnclipboard_autolinked_build/CMakeFiles/react_codegen_rnclipboard.dir/react/renderer/components/rnclipboard/EventEmitters.cpp.o
  [6/55] Building CXX object rnclipboard_autolinked_build/CMakeFiles/react_codegen_rnclipboard.dir/react/renderer/components/rnclipboard/ShadowNodes.cpp.o
  [7/55] Building CXX object rnclipboard_autolinked_build/CMakeFiles/react_codegen_rnclipboard.dir/react/renderer/components/rnclipboard/ComponentDescriptors.cpp.o
  [8/55] Building CXX object rnclipboard_autolinked_build/CMakeFiles/react_codegen_rnclipboard.dir/react/renderer/components/rnclipboard/Props.cpp.o
  [9/55] Building CXX object rnclipboard_autolinked_build/CMakeFiles/react_codegen_rnclipboard.dir/react/renderer/components/rnclipboard/rnclipboardJSI-generated.cpp.o
  [10/55] Building CXX object rnclipboard_autolinked_build/CMakeFiles/react_codegen_rnclipboard.dir/rnclipboard-generated.cpp.o
  [11/55] Building CXX object CMakeFiles/appmodules.dir/OnLoad.cpp.o
  [12/55] Building CXX object ..../ant-delivery-v2/android/app/build/generated/autolinking/src/main/jni/autolinking.cpp.o
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /Users/nazacity/Library/Android/sdk/cmake/3.22.1/bin/ninja \
       android/app/.cxx/Debug/554p6h4o/arm64-v8a \
        appmodules \
        react_codegen_rnscreens \
        react_codegen_rnsvg \
        react_codegen_safeareacontext
    from ./android/app

package

"react-native": "^0.76.1",
"react-native-safe-area-context": "^4.13.1",
"react-native-screens": "^3.35.0",
"react-native-gesture-handler": "^2.20.2",
"@react-native/codegen": "^0.76.1",

React native info

System:
  OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 571.30 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.nvm/versions/node/v18.17.1/bin/node
  Yarn: Not Found
  npm:
    version: 9.6.7
    path: ~/.nvm/versions/node/v18.17.1/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "23"
      - "27"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-29 | Intel x86 Atom_64
      - android-29 | Google APIs Intel x86 Atom
      - android-30 | ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-33 | ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-VanillaIceCream | Google APIs ARM 64 v8a
      - android-VanillaIceCream | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: 15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: ^0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
laurensk commented 3 weeks ago

See https://github.com/th3rdwave/react-native-safe-area-context/issues/541#issuecomment-2438961170

mbpictures commented 3 weeks ago

have the same error, even with the newest version (as op mentioned in the title)

nazacity commented 3 weeks ago

i upgrade to rn 0.76.1 still got the error

vonovak commented 3 weeks ago

Hello! Can you try cleaning your android project and running find . -name ".cxx" -type d -prune -exec rm -rf '{}' + (deletes .cxx folders which might be cached from previous build) from the root of your repo? Please let me know if that helps, thank you.

edit: or alternatively git clean -xfd

mbpictures commented 3 weeks ago

I already tried that (deleting .cxx and build folders from android and android/app and deleting&reinstalling whole node_modules) without any success

vonovak commented 3 weeks ago

Hi! Well, in that case I believe a Minimal, Reproducible Example will be needed. Note that the CI on this PR passes - that PR runs an app with RN 0.76.1 and builds for both old and new architecture.

nazacity commented 3 weeks ago

i upgraded react-native-safe-area-context to V4.13.1 delete node_modules reinstall delete .cxx folder npx react-native clean still no hope

nazacity commented 3 weeks ago

i updated every lib by ncu -i then delete node_modules reinstall again and npm run state --reset-cache this time success

I already tried that (deleting .cxx and build folders from android and android/app and deleting&reinstalling whole node_modules) without any success

try to update all lib specially
"@react-native/codegen": "^0.76.1", "@react-native/gradle-plugin": "^0.76.1",