5

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.

I remember yesterday I run the command gradlew clean in one of my old project.. is this effecting on my new project?

I would be really thankful if someone helps

This is 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)
5
  • Have you linked react-native-gesture-handler?
    – Andrew
    Commented Feb 3, 2019 at 16:03
  • yes I did link...
    – Basit
    Commented Feb 3, 2019 at 16:05
  • Did you make the modification to MainActivity.java?
    – Andrew
    Commented Feb 3, 2019 at 16:10
  • Yes I did as mentioned in react navigation documentations... added some files
    – Basit
    Commented Feb 3, 2019 at 16:14
  • posted the full error... it says some problem in settings.gradle file but its same as my old projects
    – Basit
    Commented Feb 3, 2019 at 16:27

3 Answers 3

18

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

2
  • 1
    thanks a lot we are all so bored cause of these bugs from RN :( Commented Feb 9, 2019 at 21:55
  • As a sidenote, this bug is not caused by react native, instead its caused by react native cli
    – RegularGuy
    Commented Feb 11, 2019 at 21:10
0

Make sure you already have installed python 2 and last version of jdk And make sure you have already set ANDROID_HOME And you should follow this structure : https://facebook.github.io/react-native/docs/getting-started.html

0

Clear the android emulator cache . It worked for me .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.