0

I recently started my React Native journey and hit a snag before I could even start to code. I followed the guide by Facebook on how to set up your environment for a React Native project, though I installed java SDK, python and node manually instead of through chocolatey. Installing the react native application on my system went smoothly but when I try to run on my Android Emulator by using the command react-native run-android, I run into the following Error message.

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.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
The system cannot find the path specified.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

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
The system cannot find the path specified.

Note: I have not made any changed in any file nor deleted anything


Steps to reproduce

  • Run the command react-native init AwesomeProject
  • cd AwesomeProject
  • Ensure Emulator is running then start Metro Bundler with react-native start
  • Run command react-native run-android in a separate terminal to receive error

Steps taken to resolve

I have tried following multiple issues and queries of others with similar problems to no avail

  • I tried re-installing everything from scratch to no avail, and creating a new project but the same message appears after hours of re-installation
  • One person suggested running gradle wrapper inside the project folder, but that too made no difference
  • Another suggested that a file name gradle-wapper.jar would be missing, but its there in the project folder
  • I tried loading the Android folder of the react native project in my Android Studio, the gradle starts building but there is still no success when the gradle is built

Packages Installed

  • Node V12.18.2
  • Java SDK V8
  • Python 2.7
  • Android Studio SDK [Android 10.0 (Q)]
  • Android SDK Build-Tools (Installed)
  • Android Emulator (Installed)
  • Android SDK Platform-Tools (Installed)
  • Intel x86 Emulator Accelerator (HAXM Installer) (Installed)

Please let me know if any further information is required to understand my problem. Thanks!

aieyan
  • 123
  • 4
  • 7
  • Have you made changes in the environment variable after installation? – Abhishek Sep 01 '20 at 11:01
  • Umm no, was i supposed to? There was nothing mentioned in the react native docs. – aieyan Sep 01 '20 at 11:05
  • Yes check in Android development environment in the 3rd step on https://reactnative.dev/docs/environment-setup – Abhishek Sep 01 '20 at 11:08
  • Oh those, sorry i misunderstood your question. Yes I have configured those. ANDROID_HOME variable has been created and platform-tool, android-sdk and emulator have all been added to path. – aieyan Sep 01 '20 at 11:13
  • ok may be issue with gradle, check in the android studio if any error while gradle sync – Abhishek Sep 01 '20 at 11:17
  • try to clean gradle in android folder by running command 'gradlew clean' and open android studio and check if any error while gradle sync – Abhishek Sep 01 '20 at 11:20
  • I tried running in android studio, gradle sync finshed successfully without any errors. When i try to clean gradle using `gradlew clean` in the android folder it gives me this error message `Error: could not find or load main class org.gradle.wrapper.GradleWrapperMain` – aieyan Sep 01 '20 at 11:35
  • check this if any of these solution works https://stackoverflow.com/questions/43521533/error-could-not-find-or-load-main-class-org-gradle-wrapper-gradlewrappermain – Abhishek Sep 01 '20 at 11:41
  • Thanks John, i will look into it and let you know if things start to work! – aieyan Sep 01 '20 at 11:44
  • Welcome :) feel free to ask – Abhishek Sep 01 '20 at 11:45

0 Answers0