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.

Connection refused when running android project

See original GitHub issue

Environment

OS: Windows 7 Node: 8.11.1 Yarn: Not Found npm: 5.6.0 Watchman: Not Found Xcode: N/A Android Studio: Not Found

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.4 => 0.55.4

Description

Connection refused while running react-native run-android

Steps to Reproduce

react-native run-android

Expected Behavior

Build success

Actual Behavior

[DeviceMonitor]: Unable to open connection to: localhost/xx.xxx.xxx.xx:5037, due to: java.net.ConnectException: Connection refused: connect [DeviceMonitor]: Connection attempts: 1 [DeviceMonitor]: Unable to open connection to: localhost/xx.xxx.xxx.xx:5037, due to: java.net.ConnectException: Connection refused: connect [DeviceMonitor]: Connection attempts: 2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

8reactions
minhphung210commented, Dec 25, 2018

It’s due to fact that Win7 prefers to return IPV6 address for localhost and mine was not properly setup. So I forced java to use IPV4 adress by adding a new environment variable : _JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true And it fixed it.

in what file?

cd your project file and paste it to terminal for mac: export _JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true

3reactions
vbraekecommented, Jun 12, 2018

It’s due to fact that Win7 prefers to return IPV6 address for localhost and mine was not properly setup. So I forced java to use IPV4 adress by adding a new environment variable :

_JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true

And it fixed it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Studio - Connection refused: connect - Stack Overflow
1 Answer 1 · Back to Android Studio > File > Settings > HTTP Proxy > Set Manual proxy configuration to credentials from...
Read more >
Android device connection refused in WebClient download ...
The mobile app is using the Ip address of the PC and a number of ports have been tried yielding the same response....
Read more >
Connection Refused Error On My Wife's Phone - Works On Mine
I recently installed the Home Assistant app on my Android phone Pixel 4 XL. I went through the Duck DNS and HTTPS setup...
Read more >
How to Fix the SSH "Connection Refused" Error - Kinsta
1. Your SSH Service Is Down ... In order to connect to your server with SSH, it must be running an SSH daemon...
Read more >
Set up Android Emulator networking
Communication with the emulated device may be blocked by another (physical) firewall or router where your machine is connected. The emulator's ...
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