Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"
  }
}
like image 394
Ovais Butt Avatar asked Jan 29 '19 06:01

Ovais Butt


3 Answers

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]

like image 148
Alex K - JESUS first Avatar answered Oct 22 '22 02:10

Alex K - JESUS first


cd ./android
create file file local.properties

then past this code sdk.dir=C\:\\Users\\muhammad ali\\AppData\\Local\\Android\\Sdk change location to as per your sdk is located Done. you already have local.properties file good. find similar file of code sdk.dir=C\:\\Users\\muhammad ali\\AppData\\Local\\Android\\Sdk change location to as per your sdk is located Done.

like image 2
Muhammad Ali Avatar answered Oct 22 '22 04:10

Muhammad Ali


I had the same issue today... Wondering if you solved it?

go to android folder then settings.gradle file

You may find it on line 3

'..\node_modules\react-native-gesture-handler\android'

and replace all these backward slashes with forward like this

'../node_modules/react-native-gesture-handler/android'

Let me know if this helps...

like image 1
Basit Avatar answered Oct 22 '22 02:10

Basit