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

4

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.

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)
Cordie answered 3/2, 2019 at 16:2 Comment(5)
Have you linked react-native-gesture-handler?Bihari
yes I did link...Cordie
Did you make the modification to MainActivity.java?Bihari
Yes I did as mentioned in react navigation documentations... added some filesCordie
posted the full error... it says some problem in settings.gradle file but its same as my old projectsCordie
G
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

Greenback answered 3/2, 2019 at 16:29 Comment(2)
thanks a lot we are all so bored cause of these bugs from RN :(Subcontinent
As a sidenote, this bug is not caused by react native, instead its caused by react native cliGreenback
C
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

Convery answered 6/2, 2019 at 4:19 Comment(0)
R
0

Clear the android emulator cache . It worked for me .

Rigsby answered 6/7, 2024 at 18:12 Comment(0)
T
0

I hade a similar issue, fixed it by simply entering my android directory and running ./gradlew clean.

Textualist answered 29/9, 2024 at 12:28 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.