'How to run react-native application in android which is cloned from a github repository?

I was working on a local project from scratch which was not on github and it was running successfully. But when i clone a project from github and try to run on android, mostly (not every application cloned from github gives me this error but few big application gives) it gives me error like

Command That I run:

npx react-native run-android

Error that I get:

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain


Solution 1:[1]

make sure you have configure the environment of react native in your machine(desktop/laptop).

follow the link for environment Setup:

https://reactnative.dev/docs/environment-setup after that follow below steps:

  1. Clone the project from github.
  2. cd projectName
  3. npm install
  4. npx react-native run-android

Solution 2:[2]

Clone the project and Open that folder

--> npm install

--> cd ios -> pod install

--> gradle wrapper

--> npx react-native run-android

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Meisan Saba
Solution 2 Apps Maven