0
votes

i built a react native app and integrated it with firebase. it works fine in ios when i run with npx react-native run-ios. It even works in android if i open the project directly in android studio and run it. but when i run the command run-android i get the error below:

npx react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 1153 file(s) to forward-jetify. Using 8 workers... info JS server already running. info Installing the app...

FAILURE: Build failed with an exception.

  • What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

  • 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 932ms

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

npm ERR! code 1 npm ERR! path /Users/manishshukla/Documents/technical/mytestapp npm ERR! command failed npm ERR! command sh -c react-native run-android

npm ERR! A complete log of this run can be found in: npm ERR! /Users/manishshukla/.npm/_logs/2020-12-06T21_55_04_212Z-debug.log

2

2 Answers

0
votes

enter image description here

basically gradle-6.3 did the trick. when i set up everything it was 6.2. in gradle-wrapper.properties i had to change 6.2 to 6.3 like this:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
0
votes

try running npx react-native doctor in your project's directory terminal and when you got the error just press e inside your terminal and it will install/upgrade your files according to it