skip to Main Content

I created a new React Native Project—Cli and installed these npm packages: npm install @react-navigation/native, npm install @react-navigation/stack, and npm install @react-navigation/elements. My project is running perfect but when I install npm install react-native-gesture-handler and run my project using npx react-native run-android.

It showed an error and I tried but the error was not resolved.

Task :app:configureCMakeDebug[arm64-v8a] FAILED
Task :react-native-gesture-handler:compileDebugKotlin FAILED

Task :app:configureCMakeDebug[arm64-v8a]
C/C++: CMake Error at C:/Users/haide/Desktop/RN Test/AwesomeProject/android/app/build/generated/autolinking/src/main/jni/Android-autolinking.cmake:9 (add_subdirectory):
C/C++:   add_subdirectory called with incorrect number of arguments
C/C++: Call Stack (most recent call first):
C/C++:   C:/Users/haide/Desktop/RN Test/AwesomeProject/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:86 (include)
C/C++:   CMakeLists.txt:31 (include)
C/C++: CMake Error at C:/Users/haide/Desktop/RN Test/AwesomeProject/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:89 (target_link_libraries):
C/C++:   Cannot specify link libraries for target
C/C++:   "react_codegen_rngesturehandler_codegen" which is not built by this
C/C++:   project.
C/C++: Call Stack (most recent call first):
C/C++:   CMakeLists.txt:31 (include)

> Task :app:configureCMakeDebug[arm64-v8a] FAILED

> Task :react-native-gesture-handler:compileDebugKotlin FAILED

Dependences and version of my project.

"dependencies": {
    "@react-navigation/elements": "^2.0.0",
    "@react-navigation/native": "^7.0.0",
    "@react-navigation/stack": "^7.0.0",
    "react": "18.3.1",
    "react-native": "0.76.1",
    "react-native-gesture-handler": "^2.16.0"
  },

2

Answers


  1. You can can change buildToolsVersion and buildToolsVersion in android/build.gradle – like this:

    // android/build.gradle
    buildscript {
      ext {
        buildToolsVersion = 33
        compileSdkVersion = 33
        targetSdkVersion  '33.0.0'
      }
    }
    
    Login or Signup to reply.
  2. The error

    C/C++:   add_subdirectory called with incorrect number of arguments
    

    could be result of a broken autogeneration in case of paths containing spaces: https://github.com/facebook/react-native/issues/47377

    You could either avoid paths with spaces (like RN Test as in your case) or use newer version of react-native: they said the problem will be fixed in 0.76.2.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search