mrousavy / react-native-jsi-image

🖼️ A writeable in-memory Image JSI Host Object
MIT License
287 stars 4 forks source link

Cant run the built after installing the package #10

Open johnvsmit31 opened 1 year ago

johnvsmit31 commented 1 year ago

When I install the package npm I react-native-jsi-image on android and then npx react-native run-android it fails my built and gives me this error can anyone please help me to fix this i really want to use this package 🙏 i am using react native cli with very latest version of react native

The Error:


See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
132 actionable tasks: 115 executed, 17 up-to-date
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-jsi-image:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\react-native-jsi-image\android\CMakeLists.txt: -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: D:/Andriod Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: D:/Andriod Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done

  C++ build system [configure] failed while executing:
      @echo off
      "D:\\Andriod Sdk\\cmake\\3.18.1\\bin\\cmake.exe" ^
        "-HC:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android" 
^
        "-DCMAKE_SYSTEM_NAME=Android" ^
        "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" ^
        "-DCMAKE_SYSTEM_VERSION=16" ^
        "-DANDROID_PLATFORM=android-16" ^
        "-DANDROID_ABI=arm64-v8a" ^
        "-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" ^
        "-DANDROID_NDK=D:\\Andriod Sdk\\ndk\\23.1.7779620" ^
        "-DCMAKE_ANDROID_NDK=D:\\Andriod Sdk\\ndk\\23.1.7779620" ^
        "-DCMAKE_TOOLCHAIN_FILE=D:\\Andriod Sdk\\ndk\\23.1.7779620\\build\\cmake\\android.toolchain.cmake" ^
        "-DCMAKE_MAKE_PROGRAM=D:\\Andriod Sdk\\cmake\\3.18.1\\bin\\ninja.exe" ^
        "-DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -fstack-protector-all" ^
        "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android\\build\\intermediates\\cxx\\Debug\\3ti2o4y3\\obj\\arm64-v8a" ^
        "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=C:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android\\build\\intermediates\\cxx\\Debug\\3ti2o4y3\\obj\\arm64-v8a" ^
        "-DCMAKE_BUILD_TYPE=Debug" ^
        "-BC:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android\\.cxx\\Debug\\3ti2o4y3\\arm64-v8a" ^
        -GNinja
    from C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\react-native-jsi-image\android
  CMake Warning (dev) in CMakeLists.txt:
    No project() command is present.  The top-level CMakeLists.txt file must
    contain a literal, direct call to the project() command.  Add a line of
    code such as

      project(ProjectName)

    near the top of the file, but after cmake_minimum_required().

    CMake is pretending there is a "project(Project)" command on the first
    line.
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Warning at D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    D:/Andriod Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)

  CMake Warning at D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Warning at D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Error at CMakeLists.txt:6 (add_library):
    Cannot find source file:

      ../cpp/TypedArray/TypedArray.cpp

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
    .hpp .hxx .in .txx

  CMake Error at CMakeLists.txt:6 (add_library):
    No SOURCES given to target: jsi-image

  CMake Generate step failed.  Build files cannot be regenerated correctly.

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* 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 4m 10s

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-jsi-image:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\react-native-jsi-image\android\CMakeLists.txt: -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: D:/Andriod Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: D:/Andriod Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done

  C++ build system [configure] failed while executing:
      @echo off
      "D:\\Andriod Sdk\\cmake\\3.18.1\\bin\\cmake.exe" ^
        "-HC:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android" 
^
        "-DCMAKE_SYSTEM_NAME=Android" ^
        "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" ^
        "-DCMAKE_SYSTEM_VERSION=16" ^
        "-DANDROID_PLATFORM=android-16" ^
        "-DANDROID_ABI=arm64-v8a" ^
        "-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" ^
        "-DANDROID_NDK=D:\\Andriod Sdk\\ndk\\23.1.7779620" ^
        "-DCMAKE_ANDROID_NDK=D:\\Andriod Sdk\\ndk\\23.1.7779620" ^
        "-DCMAKE_TOOLCHAIN_FILE=D:\\Andriod Sdk\\ndk\\23.1.7779620\\build\\cmake\\android.toolchain.cmake" ^
        "-DCMAKE_MAKE_PROGRAM=D:\\Andriod Sdk\\cmake\\3.18.1\\bin\\ninja.exe" ^
        "-DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -fstack-protector-all" ^
        "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android\\build\\intermediates\\cxx\\Debug\\3ti2o4y3\\obj\\arm64-v8a" ^
        "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=C:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android\\build\\intermediates\\cxx\\Debug\\3ti2o4y3\\obj\\arm64-v8a" ^
        "-DCMAKE_BUILD_TYPE=Debug" ^
        "-BC:\\Users\\me\\Downloads\\notification_redirection-main\\notification_redirection-main\\node_modules\\react-native-jsi-image\\android\\.cxx\\Debug\\3ti2o4y3\\arm64-v8a" ^
        -GNinja
    from C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\react-native-jsi-image\android
  CMake Warning (dev) in CMakeLists.txt:
    No project() command is present.  The top-level CMakeLists.txt file must
    contain a literal, direct call to the project() command.  Add a line of
    code such as

      project(ProjectName)

    near the top of the file, but after cmake_minimum_required().

    CMake is pretending there is a "project(Project)" command on the first
    line.
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Warning at D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    D:/Andriod Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)

  CMake Warning at D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Warning at D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    D:/Andriod Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
    C:/Users/me/Downloads/notification_redirection-main/notification_redirection-main/node_modules/react-native-jsi-image/android/.cxx/Debug/3ti2o4y3/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Error at CMakeLists.txt:6 (add_library):
    Cannot find source file:

      ../cpp/TypedArray/TypedArray.cpp

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
    .hpp .hxx .in .txx

  CMake Error at CMakeLists.txt:6 (add_library):
    No SOURCES given to target: jsi-image

  CMake Generate step failed.  Build files cannot be regenerated correctly.

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* 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 4m 10s

    at makeError (C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\execa\index.js:174:9)
    at C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
    at async Command.handleAction (C:\Users\me\Downloads\notification_redirection-main\notification_redirection-main\node_modules\@react-native-community\cli\build\index.js:108:9)
info Run CLI with --verbose flag for more details.
``
sh237 commented 1 year ago

Based on the error message, it seems that the issue is related to the CMake configuration during the build process. Here are some possible steps to help you resolve the issue:

Update CMake: You can try updating CMake to the latest version by downloading and installing it from the official CMake website (https://cmake.org/download/). Once installed, make sure to update the PATH environment variable to include the new installation location.

Update NDK: You can also try updating the Android NDK to the latest version by downloading and installing it from the official Android Developers website (https://developer.android.com/ndk/downloads). Once installed, make sure to update the PATH environment variable to include the new installation location.

Add project() command: As the error message suggests, you can add a project() command to the top-level CMakeLists.txt file. You can add the following line after the cmake_minimum_required() line:

project(YourProjectName)

Make sure to replace "YourProjectName" with the actual name of your project.

Enable -Xlint:deprecation: You can try enabling the -Xlint:deprecation option by adding the following line to the android/app/build.gradle file:

android {
  ...
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    "-Xlint:deprecation"
  }
  ...
}

This will enable warnings for the use of deprecated APIs, which may help you identify the root cause of the issue.

Clean the project: You can try cleaning the project by running the following command:

cd android && ./gradlew clean

This will delete all build artifacts and regenerate them from scratch.

Check dependencies: Make sure that all the dependencies required by react-native-jsi-image are properly installed and configured. You can check the dependencies in the package.json file of the project.