Failed to connect to local IP from Android application

The client failed to establish a connection to the local address localhost:3000.

The error encountered was:

dial tcp [::1]:3000: connectex: No connection could be made because the target machine actively refused it.

How can I solve it?

2 Answers

  1. Change your localhost:3000 address to local IP address for example etc.
  2. Your server and client must be in same network


On an emulator the localhost is accessible using the IP .
So localhost:3000 will be in your emulator.

Physical device

First of all you must be on the same network to be able to connect.

  • Get the PC ip using ipconfig (windows) and ip a or ifconfig (linux)
  • Connect to the PC localhost using it’s ip. i.g
    (your firewall must be OK with this)

If you are trying to connect using code, same things are needed for this

Archive from:

Leave a Reply

Your email address will not be published. Required fields are marked *