Reputation: 7143
I am trying to build and run react native application in my phone. I tried with Getting Started and it's working fine. I do the following to run
cd AwesomeProject
react-native start
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
react-native run-android
and it runs in my android phone.
Now I am trying to run a project from GitHub, I did the following
git clone https://github.com/h87kg/NavigatorDemo.git
cd NavigatorDemo
react-native start
I get Command 'start' unrecognized. Did you mean to run this inside a react-native project?
error. What should I do to run this project ? Any help is appreciated. Thanks in advance.
Update
After installing dependencies npm install
I am able to run 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.
Upvotes: 20
Views: 61002
Reputation: 59
npm install react-native-fs --save --legacy-peer-deps
This will fix your issue
Upvotes: 0
Reputation: 769
The problem is that the gradlew file in the android folder isn't executable anymore because you cloned it from a git repo.
Basically, when you do react-native run-android
, It does a lot of thing which includs running commands for you such as cd android && ./gradlew installDebug
. right there, it tries to execute the gradlew, but can't, cause the file isn't executable. which is why you get that error.
just cd
into the android folder, and do chmod +x gradlew
.
Upvotes: 18
Reputation: 204
This is the solution that worked for me. Do not forget to close the node server during the process.
Upvotes: 1
Reputation: 7143
I have found the solution, this is how I got it working and sharing it with others who are facing the same problem
assets
inside android/app/src/main/
gradle
folder inside android/
from my existing working project AwesomeProject
(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 I followed, hope it helps.
Upvotes: 1
Reputation: 4232
Did you install node modules? try npm install
git clone https://github.com/h87kg/NavigatorDemo.git
cd NavigatorDemo
npm install
react-native start
Upvotes: 22