killserver / react-native-screenshot-prevent

MIT License
101 stars 39 forks source link

RN 0.75 New Architecture build android error #52

Open mikeky-koizora opened 2 months ago

mikeky-koizora commented 2 months ago

I don't know if there will be a development plan to support this.

hengkx commented 2 months ago

same error

itsnyx commented 1 month ago

++same

RdnSam commented 1 month ago

same here, when enable new arch error in CMake

* What went wrong:
Execution failed for task ':app:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/mac/Desktop/bugHunter/android/app/.cxx/Debug/6n123n60/arm64-v8a'
  [0/2] Re-checking globbed directories...
  [1/2] Re-running CMake...
  -- Configuring incomplete, errors occurred!
  See also "/Users/mac/Desktop/bugHunter/android/app/.cxx/Debug/6n123n60/arm64-v8a/CMakeFiles/CMakeOutput.log".
  See also "/Users/mac/Desktop/bugHunter/android/app/.cxx/Debug/6n123n60/arm64-v8a/CMakeFiles/CMakeError.log".
  FAILED: build.ninja
  /Users/mac/Library/Android/sdk/cmake/3.22.1/bin/cmake --regenerate-during-build -S/Users/mac/Desktop/bugHunter/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup -B/Users/mac/Desktop/bugHunter/android/app/.cxx/Debug/6n123n60/arm64-v8a

  C++ build system [build] failed while executing:
      /Users/mac/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -C \
        /Users/mac/Desktop/bugHunter/android/app/.cxx/Debug/6n123n60/arm64-v8a \
        appmodules \
        react-native-mmkv \
        react_codegen_RNCGeolocationSpec \
        react_codegen_RNCWebViewSpec \
        react_codegen_RNDatePickerSpecs \
        react_codegen_RNImagePickerSpec \
        react_codegen_RNMmkvSpec \
        react_codegen_RNPermissionsSpec \
        react_codegen_RNVectorIconsSpec \
        react_codegen_lottiereactnative \
        react_codegen_rnasyncstorage \
        react_codegen_rngesturehandler_codegen \
        react_codegen_rnpicker \
        react_codegen_rnreanimated \
        react_codegen_rnscreens \
        react_codegen_rnsvg \
        react_codegen_safeareacontext
    from /Users/mac/Desktop/bugHunter/android/app
  CMake Error at /Users/mac/Desktop/bugHunter/android/app/build/generated/autolinking/src/main/jni/Android-autolinking.cmake:24 (add_subdirectory):
    add_subdirectory given source
    "/Users/mac/Desktop/bugHunter/node_modules/react-native-screenshot-prevent/android/build/generated/source/codegen/jni/"
    which is not an existing directory.
  Call Stack (most recent call first):
    /Users/mac/Desktop/bugHunter/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:135 (include)
    CMakeLists.txt:31 (include)

  CMake Error at /Users/mac/Desktop/bugHunter/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:138 (target_link_libraries):
    Cannot specify link libraries for target
    "react_codegen_RNScreenshotPreventSpec" which is not built by this project.
  Call Stack (most recent call first):
    CMakeLists.txt:31 (include)

  ninja: error: rebuilding 'build.ninja': subcommand failed

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 45s
info Run CLI with --verbose flag for more details.
batuhanoztrk commented 1 month ago

I encountered the same issue while working with the New Architecture in React Native 0.75, specifically the error related to react_codegen_RNScreenshotPreventSpec. To resolve this, I created a package that addresses this issue: rn-screenshot-prevent. This package prevents the screenshot-related errors during the build process. You can give it a try and see if it helps fix the CMake errors you're facing. Let me know if you run into any issues!