question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not connect to development server on android emulator and on real device

See original GitHub issue

Is 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

  1. react-native -v: 0.47.1
  2. node -v:8.2.1
  3. npm -v:4.1.2
  4. yarn --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’.

screenshot-1502041340496 screenshot-1502041361543 screenshot-1502041433294

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:closed
  • Created 6 years ago
  • Reactions:88
  • Comments:139 (7 by maintainers)

github_iconTop GitHub Comments

343reactions
ashafizullahcommented, Aug 9, 2017

Try to run: adb reverse tcp:8081 tcp:8081 on your command prompt and re-run your project after that.

154reactions
Eyesonly88commented, Apr 30, 2019

I added android:usesCleartextTraffic="true" to AndroidManifest.xml at the <application ... tag and rebuilt the app. After that, it started to load from dev server normally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not connect to React Native development server on ...
Open the in-app Developer menu. shake your phone or press CMD/ctrl + M · Click on Settings · click on Debug server host...
Read more >
Could not connect to development server : ReactNative
Connection of multiple devices: Enter adb devices command your terminal to a check the list of connected devices. · Run the react server...
Read more >
Troubleshoot known issues with Android Emulator
This page lists known issues, workarounds, and troubleshooting tips for the Android Emulator. If you encounter an issue not listed here or ...
Read more >
Unable to load script/could not connect to dev server - Android ...
The application compiles without errors and the Android emulator is running properly. However, when I run react-native run-android , I get ...
Read more >
Could not connect to React Native development server on ...
Android : Could not connect to React Native development server on Android [ Beautify Your Computer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found