Command Failed: gradlew.bat installDebug error whenever installing dependencies like navigation, firebase, icons etc in React-Native

Ovais Butt picture Ovais Butt · Jan 29, 2019 · Viewed 47.7k times · Source

When ever i install any dependency in my react native project and when ever i use link command for e.g react-native link react-native-gesture-handler this causes me an error shown in the image [1]. It doesn't build the project shows the error gradlew.bat

The following code shows my package.json file

{
  "name": "navigations",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.6.3",
    "react-native": "0.58.3",
    "react-native-gesture-handler": "^1.0.15",
    "react-navigation": "^3.0.9"
  },
  "devDependencies": {
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "24.0.0",
    "jest": "24.0.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

Answer

Alex Karpov picture Alex Karpov · Feb 15, 2019

If you have WINDOWS machine, please follow these steps:

Optional (
  Delete iOS, Android folders

  Run `react-native eject` ( that command will rebuild deleted folders for you )
)

Then :

1) cd ./android

2) ./gradlew.bat installDebug ( with dot at the beggining )

Once it's successfully finished

3) cd ../ ( go back to root folder )

4) react-native run-android

And fingers crossed for it to work as expected :) [for me it does]