Clone and run your own projects from GitHub

I am trying to create and start the reaction of a native application on my phone. I tried with Getting Started and it works great. For execution

follow these steps:
  • cd AwesomeProject
  • react-native start
  • Open a new tab in the terminal
  • curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

  • react-native run-android

and it works on my android phone.

Now I'm trying to start a project from GitHub , I did the following

  • git clone https://github.com/h87kg/NavigatorDemo.git
  • cd NavigatorDemo
  • react-native start

I get a Command 'start' unrecognized. Did you mean to run this inside a react-native project? error Command 'start' unrecognized. Did you mean to run this inside a react-native project? Command 'start' unrecognized. Did you mean to run this inside a react-native project? . What to do to start this project? Any help is appreciated. Thanks in advance.

Update

After installing the npm install dependencies, I can start the server. Now when I try to run react-native run-android , I get the following error

 JS server already running. Building and installing the app on the device (cd android && ./gradlew installDebug)... Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Could not install the app on the device, see the error above. 
+5
source share
3 answers

The solution seems to be a hack .. The problem is that the gradlew file in the android folder no longer works because you cloned it from the git repository.

Basically, when you do react-native run-android , it does a lot of things that include running commands for you, such as cd android && ./gradlew installDebug . right there, it tries to execute gradlew, but cannot, because the file is not executable. therefore you get this error.

just cd to android folder and do chmod +x gradlew . This should fix it, not copy files.

+6
source

Have you installed node modules ? try npm install

  • git clone https://github.com/h87kg/NavigatorDemo.git
  • cd NavigatorDemo
  • npm install
  • react-native start
+2
source

I found a solution, this is how I got his work and shared it with others who are facing the same problem.

  • Create a folder called assets inside android/app/src/main/
  • Copy gradle folder inside android/ from my existing AwesomeProject working project
  • (cd android && ./gradlew installDebug)
  • curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
  • react-native run-android

These are the exact steps that I followed, hope this helps.

0
source

All Articles