androidreact-nativecmakereact-native-gesture-handlerreact-native-navigation-v2

React Native - Navigation Dependencies Integration Error


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"
  },

Solution

  • Please remove the white space from your folder name 'RN Test' and try again.