React-native: Android "Could not connect to development server" even I can see the packager log.

Created on 26 Jul 2016  路  9Comments  路  Source: facebook/react-native

I've integrated React-Native into my existing android app.
But I see the classic red screen notify me "Could not connect to development server.".
I run "adb reverse tcp:8081 tcp:8081" and try "Dev Setting".

When I click the red screen 'Reload JS" button.
I even see the log request in the packager like below.

[12:34:06 PM] request:/index.android.bundle?platform=android&dev=true&hot=false&minify=false
[12:34:06 PM] request:/index.android.bundle?platform=android&dev=true&hot=false&minify=false (18ms)

But it still give me the red screen.

Ran Commands Locked

Most helpful comment

I ran into the same problem. React native's server is running and the reverse port forwarding is setup using adb. But I get the red page complaining about could not connect to development server. But when I reload the app, it fetches the js bundle from development server ( It's proof that there is a bug some where) but after fetching bundler the red screen pops up.

Also this link is broken https://productpains.com/post/react-native/android-could-not-connect-to-development-server-even-i-can-see-the-packager-log-

All 9 comments

I have the same question^^^^ and the Packager took a long time to launch.

I've run into this a few times, if you aren't running android 5.0+ you will have to be on the same wifi network and enter into the dev settings and manually type in the local network ip of your development machine for it to connect because adb reverse won't work. I've also had it happen because my USB cable was acting funny and was losing connection, I've also had it happen because a program running on my development machine was kicking the device out of the usb device list.

I've resolved my problem. The package.json file, 'dependencies' section need to include react.
for example

"dependencies":{
"react":"^15.2.1",
"react-native":"^0.28.0"
}

@facebook-github-bot label Icebox

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/android-could-not-connect-to-development-server-even-i-can-see-the-packager-log-

ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub.

Also, if this issue is a bug, please consider sending a PR with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

@facebook-github-bot close

@charpeni tells me to close this issue. If you think it should still be opened let us know why.

I ran into the same problem. React native's server is running and the reverse port forwarding is setup using adb. But I get the red page complaining about could not connect to development server. But when I reload the app, it fetches the js bundle from development server ( It's proof that there is a bug some where) but after fetching bundler the red screen pops up.

Also this link is broken https://productpains.com/post/react-native/android-could-not-connect-to-development-server-even-i-can-see-the-packager-log-

npm start

Was this page helpful?
0 / 5 - 0 ratings