react-nativereact-navigationgesture

getting error gradlew.bat installDebug after installing react navigation and gesture handler


I create the new react native app using command react-native init appName. After the app created successfully install it in my device using command react-native run-android, it installed successfully, and works fine... no issue

but as soon I install react navigation and gesture handler I am getting the error that Command failed: gradlew.bat installDebug after running command react-native run-android I don't know what's wrong... my old react native projects are working perfectly fine.

Yesterday I run the command gradlew clean in one of my old projects... is this affecting my new project?

This is the complete error:

  FAILURE: Build failed with an exception.

  * Where:
  Settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle' line: 3

  * What went wrong:
  Could not compile settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle'.
  > startup failed:
  settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle': 3: unexpected char: '\' @ line 3, column 133.
     s\react-native-gesture-handler\android')
                                   ^

  1 error


  * 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 1s
  Could not install the app on the device, read the error above for details.
  Make sure you have an Android emulator running or a device connected and have
  set up your Android development environment:
  https://facebook.github.io/react-native/docs/getting-started.html

  Command failed: gradlew.bat installDebug

  Error: Command failed: gradlew.bat installDebug
     at checkExecSyncError (child_process.js:616:11)
     at Object.execFileSync (child_process.js:634:13)
     at runOnAllDevices (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
     at buildAndRun (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
     at isPackagerRunning.then.result (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
     at process._tickCallback (internal/process/next_tick.js:68:7)

Solution

  • Oh yeah, it´s a bug i think with RN 0.58 link command

    open settings.gradle with a text editor from => 'D:\React Native Apps\Practice\newapp\android\settings.gradle'

    replace all '\' with '/' , in my case i had to replace '..\node_modules\react-native-gesture-handler\android' with '../node_modules/react-native-gesture-handler/android'

    then react-native run-android