Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native android error Failed to install the app native_modules.gradle' line: 170 [duplicate]

running react-native run-android in windows but get this error:

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 :ReactNative:Unexpected empty result of running 'npx --quiet --no-install react-native config' command from 'null' directory. :ReactNative:Running 'npx --quiet --no-install react-native config' command from 'null' directory failed.

FAILURE: Build failed with an exception.

  • Where: Script '/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 170

  • What went wrong: A problem occurred evaluating script.

    Command config unrecognized. Make sure that you have run npm install and that you are inside a react-native project.

like image 706
milad shafiei Avatar asked Dec 02 '19 14:12

milad shafiei


2 Answers

Try running (inside android folder)

 ./gradlew clean 

and then run

 react-native run-android
like image 73
Mudit Gulgulia Avatar answered Sep 20 '22 05:09

Mudit Gulgulia


Add this to gradle.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

and add this to gradle.wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

then run react-native run-android

like image 33
Manik Verma Avatar answered Sep 21 '22 05:09

Manik Verma