Could not connect to development server on android emulator and on real device
See original GitHub issueIs this a bug report?
Its an issue i am facing while running the normal Awesome Project on my system
Have you read the Contributing Guidelines?
Yes
Environment
react-native -v
: 0.47.1node -v
:8.2.1npm -v
:4.1.2yarn --version
:
Then, specify:
- Target Platform: Android
- Development Operating System: Windows 7
- Build tools:26.0.0-rc2
Steps to Reproduce
(Write your steps here:)
1.Open command prompt in Administrator Mode 2.run command: cd <directory where i want to create the project> 3.run command: react-native init <project name> 4.run command: cd <project name> 5.run command: react-native run-android this makes the package server run automatically on port 8081. But I am not able to access the package server from browser on the machine and the mobile. I tried using http://<system ip>:port/index.android.js http://localhost:port http://127.0.0.1:port
=> I was getting the red screen on both mobile and the emulator with following message: I tried running the project on real device and on emulator. On Both I got error: "Unable to load script from assets ‘index.android.bundle’ Make sure your bundle is packaged correctly or you’re running a package server’.
reloading i get the error: “Could not connect to development server.”
Then i set the host and port number on development setting on both and got the error “Could not connect to development server.”
Expected Behavior
The project is expected to run on emulator and phone without any error.
But instead i got the error and i have tried many times and i am getting the same error repeatedly and in same pattern.
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:88
- Comments:139 (7 by maintainers)
Try to run:
adb reverse tcp:8081 tcp:8081
on your command prompt and re-run your project after that.I added
android:usesCleartextTraffic="true"
toAndroidManifest.xml
at the<application ...
tag and rebuilt the app. After that, it started to load from dev server normally.