0

This is my first react project. I created the project using npx react-native init Projectname. The project created successfully and everything seems ok until when I tried to run the with react-native run-android, It gives the following error:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'adb' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
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 2s:

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.bat app:installDebug -PreactNativeDevServerPort=8081

My android device is connected with a USB but then also it says that the android device is not connected. I also did react-native start in another cmd window and run react-native run-android in another window but it didn't work.

  • `adb is not recognized as an internal or external command` error shows that you need to Add platform-tools to Path , platform tools can be found here `C:\Users\\AppData\Local\Android\Sdk\platform-tools` in windows – shubham jha Feb 20 '21 at 16:31
  • you shouldn't install react-native cli globally if you have installed it globally it might create some problem it is clearly mentioned in https://reactnative.dev/docs/environment-setup – shubham jha Feb 20 '21 at 16:35
  • what version of gradle and groovy are you using? – aksyuma Feb 21 '21 at 04:41
  • Does this answer your question? [How solve (Could not initialize class org.codehaus.groovy.reflection.ReflectionCache) issue in react native](https://stackoverflow.com/questions/60844245/how-solve-could-not-initialize-class-org-codehaus-groovy-reflection-reflectionc) – aksyuma Feb 21 '21 at 04:42
  • added platform-tools to path, removed react-native package but still the build gets failed. – sarthak pawar Feb 21 '21 at 08:20
  • what is error now ? – shubham jha Feb 21 '21 at 08:33

0 Answers0